Write a C program to find maximum of two numbers using macro.

C File =>

/* Write a C program to find maximum of two numbers using macro */


#include<stdio.h>
#define MAX(a,b) (a>b?a:b)
int main()
{
  int n1,n2,max;
  printf("\n Enter two numbers : ");
  scanf("%d%d%d",&n1,&n2);
  max=MAX(n1,n2);
  printf("\n Maximum of three numbers = %d",max);
  return 0;
}

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.