Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a program to find minimum between three no.s whithout
using comparison operator.

Answers were Sorted based on User's Feedback



Write a program to find minimum between three no.s whithout using comparison operator...

Answer / rajujadhav22

It is possible with ternary oprator.

Is This Answer Correct ?    27 Yes 2 No

Write a program to find minimum between three no.s whithout using comparison operator...

Answer / sanjeet kumar

with the help of ternary operator

Is This Answer Correct ?    13 Yes 2 No

Write a program to find minimum between three no.s whithout using comparison operator...

Answer / 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

Write a program to find minimum between three no.s whithout using comparison operator...

Answer / ashutosh tiwari

if((a-b)&0x8000)
if((a-c)&0x8000)
printf("a is smaller");
else if((a-c)&0x7fff)
printf("c is smaller");
else
printf("a & c are equal & smaller");
else if((a-b)&0x7fff)
if((b-c)&0x8000)
printf("b is smaller");
else if((b-c)&0x7fff)
printf("c is smaller");
else
printf("b & c are equal & smaller");
else
if((b-c)&0x8000)
printf("b is smaller");
else if((b-c)&0x7fff)
printf("c is smaller");
else
printf("a, b & c are equal & smaller");

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

differnce between do and do while

3 Answers   DOEACC,


What is the use of a semicolon (;) at the end of every program statement?

1 Answers  


write a program that will print %d in the output screen??

9 Answers   Infosys,


Write a program for the following series? 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 1234567890987654321 123456789010987654321 12345678901210987654321 1234567890123210987654321 .........1234321............ ..........123454321............ ..........12345654321............ 7 8 9 0 1 Pls............?

5 Answers  


what is the diference between pointer to the function and function to the pointer?

2 Answers   Infosys,


which will be first in c compiling ,linking or compiling ,debugging.

3 Answers   Sonata,


What is the meaning of typedef struct in c?

0 Answers  


What are the 5 elements of structure?

0 Answers  


Why is python slower than c?

0 Answers  


how to swap 4 number without using temporary number?

2 Answers  


What is scope and lifetime of a variable in c?

0 Answers  


What are predefined functions in c?

0 Answers  


Categories