Write a C program to find maximum between three numbers ?

Write a C program to find maximum between three numbers.

  1. /*Write a C program to find maximum between three numbers */
  2. #include<stdio.h>
  3. int main ()
  4. {
  5.     int a, b, c, max;
  6.     printf("find maximum between three numbers: ");
  7.     scanf("%d %d %d", &a, &b, &c);
  8.     if( a > b){
  9.         max = a;
  10.     }
  11.     if( b > a){
  12.         max = b;
  13.     }
  14.     if( b > c){
  15.         max = b;
  16.     }
  17.     if( c > a){
  18.         max = c;
  19.     }
  20.    if( a > c ){
  21.        max = a;
  22.    }
  23.    if ( c > b){
  24.     max = c;
  25.    }
  26.    printf("The maximum number is: %d\n", max);
  27.     return 0;
  28. }


Learn More :