Program to find maximum of three numbers
Program:
#include<stdio.h>
void main()
{
int a,b,c;
printf("enter three numbers to be compared: ");
scanf("%d%d%d",&a,&b,&c);
if(a==b && b==c)
{
printf("%d is same everywhere so it is greatest",a);
}
else if(a==b&& a>c)
{
printf("%d is greatest",a);
}
else if(a==c&& a>b)
{
printf("%d is greatest",a);
}
if(a==b && b==c)
{
printf("%d is same everywhere so it is greatest",a);
}
else if(a==b&& a>c)
{
printf("%d is greatest",a);
}
else if(a==c&& a>b)
{
printf("%d is greatest",a);
}
No comments:
Post a Comment