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)


else if (a


if( flag==1)

printf( "%d is greater than %d ", a,b);

else if(flag==0)

printf( "%d is greater than %d ", b,a);


printf(" Both are equal ");



*************************************************** OUTPUT ***************************************************

Enter the first number :10

Enter the second number:12

12 is greater than 10

Like it on Facebook, Tweet it or share this article on other bookmarking websites.