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 is c standard library?
#include
Which function in C can be used to append a string to another string?
What is the modulus operator?
can anyone suggest some site name..where i can get some good data structure puzzles???
What are the types of pointers?
Which type of language is c?
What is meant by realloc()?
FILE PROGRAMMING
Difference between Function to pointer and pointer to function
What is an example of structure?
What does it mean when the linker says that _end is undefined?
Explain the use of function toupper() with and example code?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What is #ifdef ? What is its application?