This program takes two numbers as inputs and compares them to show which one is greater.
#include // Header file
#include // Header file
void main() // Main function
{
int a,b flag; // Define variables
flag=2; // Initialize variables
clrscr() // Clear screen
printf(" Enter the first number: \n");
scanf("%d",&a); // Input First number
printf(" Enter the second number: \n");
scanf("%d",&b); // Input second number
if ( a>b)
flag=1;
else if (a
flag=0;
if( flag==1)
printf( "%d is greater than %d ", a,b);
else if(flag==0)
printf( "%d is greater than %d ", b,a);
else
printf(" Both are equal ");
getch();
}
*************************************************** OUTPUT ***************************************************
Enter the first number :10
Enter the second number:12
12 is greater than 10