Which of the following switch statement is not a valid statement to print “RED” if a character variable ‘color’ has the value ‘R’ or ‘r’

1.2 Which of the following switch statement is not a valid statement to print “RED” if a character
variable ‘color’ has the value ‘R’ or ‘r’?
A) switch (color) { case ‘R’: case ‘r’: printf(“RED”); break; }
B) switch (color) { case ‘R’: printf(“RED”); break;
case ‘r’ : printf(“RED”); break; }
C) switch (toupper(color)) { case ‘R’: printf(“RED”); break; }
D) switch (color) { case ‘R’ || ‘r’ : printf(“RED”); break; }

Leave a Reply