Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Basics

Home > Programs > Basics

5 / 265

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: