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
What is use of integral promotions in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What are the 5 data types?
What are the 4 types of functions?
What is c preprocessor mean?
write an algorithm to display a square matrix.
What does char * * argv mean in c?
What are structural members?
Write a program to print numbers from 1 to 100 without using loop in c?
what is stack , heap ,code segment,and data segment
c language interview questions & answer
Is it possible to have a function as a parameter in another function?
What is the value of h?
Why is c so popular?
Explain how do you print an address?