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 header file definition?

835


List out few of the applications that make use of Multilinked Structures?

1770


diff between exptected result and requirement?

1817


When c language was developed?

835


Explain what are run-time errors?

835


Which programming language is best for getting job 2020?

796


What is string in c language?

837


How can I send mail from within a c program?

797


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

904


Explain a file operation in C with an example.

898


What are the 3 types of structures?

782


What are the uses of a pointer?

882


What is a double c?

784


Explain what happens if you free a pointer twice?

824


What is the difference between strcpy() and memcpy() function in c programming?

867