Program to find larger of the two numbers without using if-else,while,for,switch

Answer Posted / gokul prajapat

void main()
{
int a,b,max;
printf("Enter two values : ");
scanf("%d%d");
max=(a>b)*a + (a<b)*b;
printf("\nmaximum value : %d",max);
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I use strcmp?

645


Is it possible to pass an entire structure to functions?

563


What is header file in c?

607


Tell me what is the purpose of 'register' keyword in c language?

621


How can I discover how many arguments a function was actually called with?

637






The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

636


How is pointer initialized in c?

589


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3129


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3192


What are data types in c language?

590


What are types of preprocessor in c?

624


What is the purpose of ftell?

601


Explain Function Pointer?

684


How to declare pointer variables?

688


What is infinite loop?

632