Write a C program to find the smallest of three integers,
without using any of the comparision operators.
Answer Posted / sachin golechha
Try Doing this way::
main()
{
int a=10,b=7,c=13; /*Assuming a Use Case */
int d; /* d is required a temporary variable */
if((a-b))
{
d = b; /* Which means a was greater than b */
}
else
{
d = a; /* Which means b was greater than a */
}
if((d-c))
{
d = c; /* Which means d was greater than c */
}
else
{
d = d; /* Which means c was greater than d */
}
/* Thus d contains the smallest number of among the 3 */
return SUCCESS;
}
| Is This Answer Correct ? | 22 Yes | 25 No |
Post New Answer View All Answers
Write a program to print factorial of given number using recursion?
What is ctrl c called?
What are the rules for identifiers in c?
What is wild pointer in c?
Write a code of a general series where the next element is the sum of last k terms.
What is difference between constant pointer and constant variable?
Why pointers are used in c?
Explain function?
Which is more efficient, a switch statement or an if else chain?
Why shouldn’t I start variable names with underscores?
Is a house a shell structure?
How does free() know explain how much memory to release?
which type of aspect you want from the student.
Why c is called top down?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?