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

What does typedef struct mean?

1117


How #define works?

1113


How can I use a preprocessorif expression to ?

1065


Explain the process of converting a Tree into a Binary Tree.

2672


develop algorithms to add polynomials (i) in one variable

2170


What is pragma in c?

1219


What is file in c language?

1010


What is the difference between text and binary modes?

1198


cavium networks written test pattern ..

4083


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1264


Can you write the function prototype, definition and mention the other requirements.

1140


which is an algorithm for sorting in a growing Lexicographic order

1810


string reverse using recursion

2476


What are the uses of null pointers?

1129


Do you know what are the properties of union in c?

1083