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
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What are file streams?
Write a program on swapping (100, 50)
What is header file in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Differentiate between the expression “++a” and “a++”?
What is a shell structure examples?
Give the rules for variable declaration?
What are the uses of a pointer?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
I came across some code that puts a (void) cast before each call to printf. Why?
What is the full form of getch?
string reverse using recursion
What is s in c?