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
What is call by reference in functions?
What is mean by data types in c?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
How can you be sure that a program follows the ANSI C standard?
What are c preprocessors?
What is typedef struct in c?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What is pointer and structure in c?
What is the use of bitwise operator?
How do I get an accurate error status return from system on ms-dos?
what is a constant pointer in C
What is the best organizational structure?
What is a file descriptor in c?
Explain how do you determine whether to use a stream function or a low-level function?