Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Why is structure important for a child?

1152


What is the use of a semicolon (;) at the end of every program statement?

1589


Process by which one bit pattern in to another by bit wise operation is?

1229


When can you use a pointer with a function?

1155


How can you determine the size of an allocated portion of memory?

1361


What will the preprocessor do for a program?

1120


Do string constants represent numerical values?

1450


How can I implement sets or arrays of bits?

1092


Why pointers are used in c?

1071


Tell me about low level programming languages.

1190


What is difference between structure and union with example?

1123


What is a string?

1171


What is difference between %d and %i in c?

1309


What is scanf_s in c?

1170


Tell me what is the purpose of 'register' keyword in c language?

1039