Write a C program to find the smallest of three integers,
without using any of the comparision operators.

Answer Posted / niranjan

main()
{
int a=5,b=2,c=3; /*Assuming a Use Case */
int d; /* d is required a temporary variable */
if(!(a/b)&& !(a/c))
{
d = a; /* Which means a is small */
}
else if ( !(b/a)&&!(b/c))
{
d = b; /* Which means b is small */
}
else
{
d = c;
}

printf("%d",d);
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1779


How can a string be converted to a number?

521


Explain what is the difference between text files and binary files?

622


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1675


What is the difference between a function and a method in c?

567






What is the best way to store flag values in a program?

583


What is a nested loop?

653


What are the similarities between c and c++?

605


What is a pointer value and address in c?

636


Here is a good puzzle: how do you write a program which produces its own source code as output?

602


Can we replace the struct function in tree syntax with a union?

786


Can we use any name in place of argv and argc as command line arguments?

612


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

678


What are header files and what are its uses in C programming?

642


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1590