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 header file definition?
List out few of the applications that make use of Multilinked Structures?
diff between exptected result and requirement?
When c language was developed?
Explain what are run-time errors?
Which programming language is best for getting job 2020?
What is string in c language?
How can I send mail from within a c program?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Explain a file operation in C with an example.
What are the 3 types of structures?
What are the uses of a pointer?
What is a double c?
Explain what happens if you free a pointer twice?
What is the difference between strcpy() and memcpy() function in c programming?