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 will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Why c is called free form language?
What are local static variables?
Can we assign string to char pointer?
What is the function of this pointer?
Explain 'far' and 'near' pointers in c.
What are Macros? What are its advantages and disadvantages?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
what value is returned to operating system after program execution?
Differentiate between null and void pointers.
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
Why main function is special give two reasons?
What are register variables in c?
What is scope of variable in c?