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
What does typedef struct mean?
How #define works?
How can I use a preprocessorif expression to ?
Explain the process of converting a Tree into a Binary Tree.
develop algorithms to add polynomials (i) in one variable
What is pragma in c?
What is file in c language?
What is the difference between text and binary modes?
cavium networks written test pattern ..
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
Can you write the function prototype, definition and mention the other requirements.
which is an algorithm for sorting in a growing Lexicographic order
string reverse using recursion
What are the uses of null pointers?
Do you know what are the properties of union in c?