Find the largest number from the given 2 numbers without using
any loops and the conditional operator.

Answers were Sorted based on User's Feedback



Find the largest number from the given 2 numbers without using any loops and the conditional opera..

Answer / surya

if(!(a/b)) // if a is less than b then division result will be zero.
02
{
03
cout << " b is greater than a";
04
}
05
else if (!(a-b)) // we know a is greater than or equal to b now. check whether they are equal.
06
{
07
cout << "a and b are equal";
08
}
09
else
10
cout << "a is greater than b";

Is This Answer Correct ?    9 Yes 6 No

Find the largest number from the given 2 numbers without using any loops and the conditional opera..

Answer / anji

We can compare two
values using unary
operators also

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Add Two Numbers Without Using the Addition Operator

0 Answers  


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

0 Answers  


how to write a c program to print list of fruits in alpabetical order?

0 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

1 Answers  


void main() {int i=2; printf("%d%d%d",i,++i,i++); getch(); }

9 Answers  






what are the files which are automatically opened when a c file is executed?

3 Answers  


what is the difference between const volatile int i & volatile const int j;

2 Answers   HCL,


What are .h files and what should I put in them?

3 Answers  


What are Storage Classes in C ?

32 Answers   CTS, HP, IBM, Maharaja Whiteline, Tamil Nadu Open University TNOU, TATA, TCS, Wipro,


Are bit fields portable?

0 Answers   EXL,


what is use#in c

3 Answers  


Explain how can I manipulate strings of multibyte characters?

0 Answers  


Categories