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
Differentiate call by value and call by reference?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
What is a macro?
What is unsigned int in c?
number of times a digit is present in a number
Write a program of prime number using recursion.
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
What is the use of a semicolon (;) at the end of every program statement?
Are there any problems with performing mathematical operations on different variable types?
Explain about C function prototype?
What are the complete rules for header file searching?
What is class and object in c?
What is the use of extern in c?
What is header file definition?
What is the purpose of realloc()?