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 / n r sree harsha

#include<stdio.h>
#include<math.h> /* for using abs() function */
main()
{
int a,b,c,small;
printf("\n enter numbers");
scanf("%d%d%d",&a,&b,&c);
if(abs(a-b)-(a-b))
{
if(abs(a-c)-(a-c))
{
s=a;
else
s=c;
}
else
{
if(abs(b-c)-(b-c))
{
s=b;
else
s=c;
}
}
printf("\n small=%d",s);
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is it usually a bad idea to use gets()? Suggest a workaround.

1873


What do you mean by command line argument?

1228


When the macros gets expanded?

1490


Why is structure padding done in c?

1194


Can you return null in c?

1229


explain how do you use macro?

1209


show how link list can be used to repersent the following polynomial i) 5x+2

2401


How can you be sure that a program follows the ANSI C standard?

1658


in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above

1087


What are predefined functions in c?

1157


How can a number be converted to a string?

1396


A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

1141


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1294


Why do we need volatile in c?

1230


Which programming language is best for getting job 2020?

1101