Write a program to find out the maximum and minimum of these 4 numbers

0
#include <stdio.h>  
    int main(){  
    int a, b, c, d;  
    printf("Enter 4 Numbers \n");  
    scanf("%d %d %d %d", &a, &b, &c, &d);  
  
    int max = a, min = a;  
  
    if (b > max){  
        max = b;  
    }  
    else if (b < min){  
        min = b;  
    }  
    if (c > max){  
        max = c;  
    }  
    else if (c < min){  
        min = c;  
    }  
    if (d > max){  
        max = d;  
    }  
    else if (d < min){  
        min = d;  
    }  
    printf("Maximum Number: %d\nMinimum Number: %d", max, min);  
  
return 0;  
}

Leave A Reply

Your email address will not be published.