What's wrong with this program (a beginner's question)

Hi, I'm learning C by self-study from King's book. I'm now on Chapter 5 re. "**if statements**" and I'm stuck on one programming project from this chapter. I need to find the largest and smallest values of 4 integers entered by the user, using as few if statements as possible. In fact, it hints that 4 statements should be enough for the purpose. I wrote this program below. I sense something is wrong (logic error), but I still can't figure out how to fix it/correct it. Could you please help? **4 if statements only**...

Code:

`// Programming Project 5.7`

#include<stdio.h>

int main(void)

{

int a = 0, b = 0, c = 0, d = 0;

int max = 0, min = 0;

printf("Enter 4 integers: ");

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

if(a > b && b > c && c > d) {

max = a;

min = d;

}

else if (b > c && c > d && d > a) {

max = b;

min = a;

}

else if(c > d && d > a && a > b) {

max = c;

min = b;

}

else if(d > a && a > b && b > c) {

max = d;

min = c;

}

printf("Largest: %d\nSmallest: %d\n", max, min);

return 0;

}