biggest of two no's with out using if condition statement

Answer Posted / k.anand

#define myabs(a,b) a>b?(a-b):(b-a)
int main()
{
int a,b;
int biggest=0;
scanf("%d%d",&a,&b);
biggest=(a+b+myabs(a,b))/2;
printf("%d",biggest);


}

Is This Answer Correct ?    6 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you check to see whether a symbol is defined?

585


Why can’t constant values be used to define an array’s initial size?

828


What will be your course of action for a push operation?

663


What is sizeof c?

604


What are the uses of a pointer?

675






Explain can the sizeof operator be used to tell the size of an array passed to a function?

591


What are the advantages and disadvantages of pointers?

570


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1514


Why static is used in c?

618


Do you know the use of 'auto' keyword?

654


Why use int main instead of void main?

590


If the size of int data type is two bytes, what is the range of signed int data type?

583


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1491


Write a program to check armstrong number in c?

633


How can I get random integers in a certain range?

609