write a program to compare 2 numbers without using logical
operators?

Answer Posted / jj

unsigned int is_same(unsigned int a, unsigned int b)
{
return (a / b);
}

int main()
{
unsigned int a, b;
a = 40, b = 40;

if ( is_same(a,b) == 1 )?
cout << "Equal" << endl
:
cout << "Not equal" << endl;
return 0;
}

Is This Answer Correct ?    0 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a variable be both const and volatile?

677


What is the use of a semicolon (;) at the end of every program statement?

776


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1622


How can I insert or delete a line (or record) in the middle of a file?

576


What does main () mean in c?

616






Calculate 1*2*3*____*n using recursive function??

1520


What is indirection?

654


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1594


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

646


Explain the ternary tree?

604


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

706


What is the use of a static variable in c?

595


what is the significance of static storage class specifier?

1666


What is omp_num_threads?

586


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

635