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 disadvantage of pointer in C
Does sprintf put null character?
Is struct oop?
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?
Is array name a pointer?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
How can you determine the size of an allocated portion of memory?
i want to asked a question about c program the question is: create a c program that displays all prime numbers less than 500? using looping statement
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Difference between for loop and while loop?
Can anyone tell what is stack overflow? what precaution we should take?