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
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 |
Answer / anji
We can compare two
values using unary
operators also
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the size of empty structure in c?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Why do we need arrays in c?
Explain the difference between ++u and u++?
What is structure and union in c?
define string ?
How can you access memory located at a certain address?
What is the best way of making my program efficient?
how to find the given number is prime or not?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
How can I read/write structures from/to data files?
How can I automatically locate a programs configuration files in the same directory as the executable?