Skip to main content

Compare two numbers

#include <stdio.h>
int main() {
   int a,b;
   printf("Enter two numbers : ");
   scanf("%d%d", &a, &b);
   if(a > b)
      printf("\n%d is greater than %d.", a, b);
   else
      printf("\n%d is greater than %d.", b, a);

   return 0;
}

Enter two numbers :  5 7

7 is greater than 5. 

Comments