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 the purpose of realloc()?
What is multidimensional arrays
Do pointers store the address of value or the actual value of a variable?
What is the difference between fread buffer() and fwrite buffer()?
What is keyword with example?
Why void is used in c?
Is it possible to pass an entire structure to functions?
What is the significance of an algorithm to C programming?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
Explain two-dimensional array.
Why doesn't C support function overloading?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
What is the size of array float a(10)?
Write a program in c to replace any vowel in a string with z?
What does volatile do?