Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: Basics

Home > Programs > Basics

5 / 248

Define a macro which gives greatest number out of 3 numbers.

Answer:

#include


#define Largest(a,b,c)((a>b)?((a>c)?a:c):((b>c)?b:c))

int main()
{
   int a,b,c,largest;
   printf("Enter 3 numbers: ");
   scanf("%d%d%d",&a,&b,&c);
   largest=Largest(a,b,c);
   printf("\nLargest of the 3 numbers: %d",largest);
   return 0;
}

Asked In :: Global Edge

Post Your Answer Here:

Language:

Post Your Reply Here: