/*C program to find greatest of two numbers using simple if*/
#include <stdio.h>int main()
{
int num1, num2;
/*
* Reads any two integer values from user
*/
printf("Enter any two numbers:\n");
scanf("%d %d", &num1, &num2);
/*
* Check if num1 > num2 or not and prints the maximum
*/
if(num1 > num2)
{
printf("%d is maximum", num1);
}
else
{
printf("%d is maximum", num2);
}
return 0;
}
output
enter any two numbers2536
36 is maximum
Comments
Post a Comment