Complete the code to print "One" when variable x equals 1 using if statement.
if (x [1] 1) { printf("One\n"); }
The operator == checks if x is equal to 1 in an if statement.
Complete the switch statement to handle the case when variable c equals 'a'.
switch(c) {
case [1]:
printf("Letter a\n");
break;
}The case label must match the value to check, so 'a' is correct.
Fix the error in the if statement condition to correctly check if n is not equal to 0.
if (n [1] 0) { printf("Non-zero\n"); }
The operator != checks if n is not equal to 0.
Fill both blanks to complete the switch statement that prints "Weekend" for 6 or 7.
switch(day) {
case [1]:
case [2]:
printf("Weekend\n");
break;
}Cases 6 and 7 represent weekend days in this example.
Fill all three blanks to complete the if-else chain that prints the day type based on day number.
if (day [1] 6 || day [2] 7) { printf("Weekend\n"); } else if (day [3] 1 && day <= 5) { printf("Weekday\n"); }
The first two blanks check if day equals 6 or 7. The last blank uses '>=' to check if day is between 1 and 5.