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


Please Help Members By Posting Answers For Below Questions

What is c standard library?

694


#include { printf("Hello"); } how compile time affects when we add additional header file .

1428


Which function in C can be used to append a string to another string?

649


What is the modulus operator?

742


can anyone suggest some site name..where i can get some good data structure puzzles???

1647






What are the types of pointers?

607


Which type of language is c?

656


What is meant by realloc()?

680


FILE PROGRAMMING

1781


Difference between Function to pointer and pointer to function

636


What is an example of structure?

591


What does it mean when the linker says that _end is undefined?

638


Explain the use of function toupper() with and example code?

657


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

651


What is #ifdef ? What is its application?

651