Write a C program to determine maximum and minimum of three numbers. Also draw the corresponding flow chart.

#include 

int main ()

{

 int a, b, c, max,min;

 printf("Enter three numbers: ");

 scanf("%d%d%d", &a, &b, &c);

 if(a > b)

 {

 if(a > c)

 {

 max = a;

 }

 else

 {

 max = c;

 }

 }

 else

 {

 if(b > c)

 {

 max = b;

 }

 else

 {

 max = c;
 }

 }

 if(a < b)

 {

 if(a < c)

 {

 min = a;

 }

 else

 {

 min = c;

 }

 }

 else

 {

 if(b < c)

 {

 min = b;

 }

 else

 {

 min = c;

 }

 }

 printf("Maximum among all three numbers = %d", max);

 printf("\nManimum among all three numbers = %d", min);

 return 0;
 }

Next Post Previous Post
No Comment
Add Comment
comment url