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
Differentiate between functions getch() and getche().
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
Calculate 1*2*3*____*n using recursive function??
What is function pointer c?
How do we open a binary file in Read/Write mode in C?
Write a c program to demonstrate character and string constants?
What functions are used for dynamic memory allocation in c language?
Can static variables be declared in a header file?
application attempts to perform an operation?
What is the difference between malloc() and calloc()?
what is different between auto and local static? why should we use local static?
Why header file is used in c?
Explain setjmp()?
Describe the difference between = and == symbols in c programming?
Is it possible to execute code even after the program exits the main() function?