I have written the following code, but I can't work out why I am not achieving the expected results.
The program is simply meant to print the value of x. This works fine for numbers 1-5 but when I change x to a number bigger than 5, it prints x does not equal 1 to 5. Can anyone see why this is?
#include <stdio.h>
int main() {
  int x = 3;
  if (x == 1) {
    printf("x equals 1\n");
  } else if (x == 2) {
    printf("x equals 2\n");
  } else if (x == 3, 4, 5) {
    printf("x equals 3, 4 or 5\n");
  } else {
    printf("x does not equal 1 to 5\n");
  }
  return 0;
}
 
     
    