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 are the advantage of c language?
What does return 1 means in c?
Why void is used in c?
What is the right type to use for boolean values in c? Is there a standard type?
Why does not c have an exponentiation operator?
Explain 'bit masking'?
How is a macro different from a function?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
What is the difference between a string and an array?
What is meant by 'bit masking'?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
Give the rules for variable declaration?
What is echo in c programming?
Why do we need a structure?