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 program to find minimum between three no.s whithout
using comparison operator.

Answer Posted / prady

#include<stdio.h>
#include<conio.h>


void main()
{


int a,b,c,temp,Num1,Num2;

printf("Enter 3 no\n");
scanf("%d%d%d",&a,&b,&c);
Num1=a;
Num2=b;
temp=Num1-Num2;
temp&=0x80000000;
temp>>=31;
switch(temp)
{
case -1: Num1=a;
Num2=c;
break;
case 0: Num1=b;
Num2=c;
break;

}
temp=Num1-Num2;
temp>>=31;
switch(temp)
{
case -1: printf("Smallest No is %d\n",Num1);
break;
case 0: printf("Smallest No is %d\n",Num2);
break;

}
getch();

}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of integral promotions in c?

1088


Why isn't any of this standardized in c? Any real program has to do some of these things.

1168


What are the 5 data types?

1062


What are the 4 types of functions?

1008


What is c preprocessor mean?

1256


write an algorithm to display a square matrix.

2655


What does char * * argv mean in c?

1010


What are structural members?

963


Write a program to print numbers from 1 to 100 without using loop in c?

1036


what is stack , heap ,code segment,and data segment

2644


c language interview questions & answer

1913


Is it possible to have a function as a parameter in another function?

1043


What is the value of h?

995


Why is c so popular?

1122


Explain how do you print an address?

1097