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 volatile c?
What are identifiers in c?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
Is multithreading possible in c?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
What is wrong in this statement? scanf(ā%dā,whatnumber);
write a programming in c to find the sum of all elements in an array through function.
What is an expression?
Is there a built-in function in C that can be used for sorting data?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
write a c program in such a way that if we enter the today date the output should be next day's date.
Explain what is meant by high-order and low-order bytes?
What does the format %10.2 mean when included in a printf statement?
What is a stream water?
What is the difference between test design and test case design?