write a program to compare 2 numbers without using logical
operators?
Answer Posted / faceless
main()
{
int result, sign_bit_num;
unsigned int x, y;
sign_bit_num = sizeof(int)*8 ;
result = x-y;
if (result) {
result = result >> (sign_bit_num-1);
if (result) {
printf("x less than y");
} else {
printf("x greater than y");
}
} else {
printf("equal");
}
| Is This Answer Correct ? | 14 Yes | 8 No |
Post New Answer View All Answers
Is c language still used?
What are structures and unions? State differencves between them.
Why is c so popular?
Is c still used?
What is calloc in c?
What is the best style for code layout in c?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is the collection of communication lines and routers called?
What are two dimensional arrays alternatively called as?
What is difference between union All statement and Union?
What are the advantages of using Unions?
What is echo in c programming?
Not all reserved words are written in lowercase. TRUE or FALSE?
Using which language Test cases are added in .ptu file of RTRT unit testing???