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
Why is structure important for a child?
What is the use of a semicolon (;) at the end of every program statement?
Process by which one bit pattern in to another by bit wise operation is?
When can you use a pointer with a function?
How can you determine the size of an allocated portion of memory?
What will the preprocessor do for a program?
Do string constants represent numerical values?
How can I implement sets or arrays of bits?
Why pointers are used in c?
Tell me about low level programming languages.
What is difference between structure and union with example?
What is a string?
What is difference between %d and %i in c?
What is scanf_s in c?
Tell me what is the purpose of 'register' keyword in c language?