Program to print the largest of two numbers using if-else construct in C

#include <stdio. h>
int main()
{ 
int x, y;
   printf(“Enter two numbers: \n”) ;
   scanf(“%d%d”, &x,&y) ;
if(x>=y)
   printf(“\n%d is the greater number.\n”, x) ;
else
   printf(“\n%d is the greater number.\n”, y) ;
return 0;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.