3. write a program to find Max. and Min. from three numbers using if else.


Program to find Max. and Min. from three numbers using if else.

 Source Code:

#include<stdio.h>
void main()
{
int a,b,c;
printf("enter three values:\n ");
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
if(a>c)
{
printf("a is max \n");
}
else
{
printf("c is max \n");
}
printf("b is max \n");
}
}

OutPut:

enter three values:
10
20
30
 c is max

No comments:

Post a Comment