Define a macro EQUALNUM to compare two numbers x and y which gives 1 if they are equal and 0 otherwise. Use this in main.

C File =>


/* Define a macro EQUALNUM to compare two numbers x and y which gives 1 if they are equal and 0 otherwise. Use this in main.*/


#include<stdio.h>
#define EQUALNUM(a,b) (a==b?1:0)
int main(){
int n,m;
int flag;
printf("\n Enter two numbers : ");
scanf("%d%d",&n,&m);
flag=EQUALNUM(n,m);
if(flag==1)
printf("\n Numbers are EQUAL");
else
printf("\n Numbers NOT EQUAL");
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”.