Program to find greatest in 3 numbers

Program to find greatest in 3 numbers
step1:-check if a is greater than b and c(a is greatest)
step2:-check if b is greater than a and c(b is greatest)
step3:-check if c is greater than a and b(c is greatest)

#include<stdio.h>
void main()
{
int a,b,c;

printf("enter value of a, b & c: \n");
scanf("%d%d%d",&a,&b,&c);

if((a>b)&&(a>c))
printf("a is greatest");

if((b>c)&&(b>a))
printf("b is greatest");

if((c>a)&&(c>b))
printf("c is greatest");
}

Related Posts