Description
This program finds the biggest among three numbers. The three numbers are read as input and stored in the variables a, b and c. Then the biggest among these values is find using if elseif statement.
Program
//Program to find the biggest among three numbers
//C program to demonstrate if elseif statement.
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter the numbers");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
if(a>c)
printf("%d is greater",a);
}
else
{
printf("%d is greater",c);
}}
elseif(b>c)
{
printf("%d is greater",b);
}
else
{
printf("%d is greater",c);
}
getch();
}
No comments:
Post a Comment