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

Write a program to print factorial of given number using recursion?

965


What is ctrl c called?

1010


What are the rules for identifiers in c?

1034


What is wild pointer in c?

1026


Write a code of a general series where the next element is the sum of last k terms.

995


What is difference between constant pointer and constant variable?

1219


Why pointers are used in c?

955


Explain function?

1043


Which is more efficient, a switch statement or an if else chain?

976


Why shouldn’t I start variable names with underscores?

1015


Is a house a shell structure?

1116


How does free() know explain how much memory to release?

1019


which type of aspect you want from the student.

2128


Why c is called top down?

1105


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

950