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
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Why pointers are used in c?
In which language linux is written?
What do header files do?
What do you mean by a local block?
What is the argument of a function in c?
Is array a primitive data type in c?
What is atoi and atof in c?
What is the mean of function?
How can you find the exact size of a data type in c?
Is javascript written in c?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Explain what is the most efficient way to store flag values?
What is ## preprocessor operator in c?