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 c program to find biggest of 3 number without
relational operator?

Answer Posted / abhishek

There is small mistake in "Kishore Kumar Naik" answer.

int main()
{
int nNum1, nNum2, nNum3;
int nRes,nSize, nBig;
nSize = sizeof(int) * 8;
printf("\nEnter 3 numbers");
scanf("%d%d%d", &nNum1, &nNum2, &nNum3);

nRes = nNum1 - nNum2;
nRes = nRes >> nSize -1;

nBig = nRes ? nNum2 : nNum1;

nRes = nBig - nNum3;
nRes = nRes >> nSize -1;

nBig = nRes ? nNum3 : nBig;

printf("big num = %d", nBig);
}

Is This Answer Correct ?    17 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is c still so popular?

1030


What is a memory leak? How to avoid it?

1321


What is break in c?

1017


I have seen function declarations that look like this

1030


Can a file other than a .h file be included with #include?

1152


Differentiate between Macro and ordinary definition.

1363


What is the size of a union variable?

1042


Why is c so important?

1046


What is c token?

1050


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

1233


How can a process change an environment variable in its caller?

1174


What is a pointer value and address in c?

1107


How do c compilers work?

1108


List some basic data types in c?

1015


Why is not a pointer null after calling free?

1005