Program to use if-else in C Language
#include <stdio.h>
int main()
{
int a, b;
printf("Enter a two numbers : ");
scanf("%d%d", &a, &b);
if (a > b)
{
printf("Bigger number=%d\n", a);
}
else
{
printf("Bigger number=%d\n", b);
}
return 0;
}
output
Enter two numbers : 15
10
Bigger number=15
Steps / Description
- Declare integer variable
a
andb
- printf inbuild function to display two numbers
- Will print the value given by
scanf
if
statementa
graterb
printf
inbuild function to display bigger number variablea