Program to find greatest of two numbers in C
In this example, you will learn to check whether a number entered by user the find greatest of two numbers.
find greatest of two numbers
Code:
include<stdio.h>
int main()
{
int Number_1, Number_2;
printf("Enter frist number:");
scanf("%d",&Number_1);
printf("Enter Second number:");
scanf("%d",&Number_2);
if(Number_1>=Number_2)
printf(" %d is largest",Number_1);
else
printf(" %d is largest",Number_2);
}
In the program, two integer value entered by the user is stored in the variable Number_1 and Number_2.
Then,if condition checked.
condition is true then print Number_1 largest or conditions is flash then Number_2 largest.
0 Comments