C Program For Finding The Largest of Two Numbers Using Macros

C Program :
/* Aim: Write a C program for finding the largest of two numbers 
#include<:stdio.h>:
#define large(a,b) a>b?a:b

void main()
{
	int num1,num2; 

	printf("\n Enter Two Numbers:- ");
	scanf("%d%d",&num1,&num2);

	printf("\n The largest among (%d,%d) is %d \n \n",num1,num2,large(num1,num2));
}
 

/* Output of above code:-

[root@localhost Computer Science AI]# cc CPLargeNum.c
[root@localhost Computer Science AI]# ./a.out

 Enter Two Numbers:- 10 15

 The largest among (10,15) is 15 

*/

Comments