You see, I\'ve self-taught myself C++ (not completely, I\'m still procrastinating -_-). So, now I started university and they\'re teaching C and they made us do a program of
This is C code has only 4 if statements. It moves max number to d position and min number to a position. Values b and c are not properly arranged within a sequence, but since requirements ask for min and max this code completes a job:
#include
int main() {
int a, b, c, d, temp;
printf("Enter four digits: ");
scanf("%d %d %d %d", &a, &b, &c, &d);
if ( a > b){
temp = a; a = b ; b = temp;
}
if ( c > d){
temp = c; c = d ; d = temp;
}
if ( b > d ){
temp = b; b = d; d = temp;
}
if ( a > c){
temp = a; a = c ; c = temp;
}
printf("Max %d\nMin %d\n", d, a);
return 0;
}