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
How can I sort more data than will fit in memory?
write a program to display all prime numbers
why we wont use '&' sing in aceesing the string using scanf
What are the different types of objects used in c?
What is the general form of function in c?
Here is a neat trick for checking whether two strings are equal
What is difference between static and global variable in c?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
What is the difference between the = symbol and == symbol?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What is meant by inheritance?
Explain the properties of union.
What are control structures? What are the different types?
What are the types of bitwise operator?