Write an expression that prints “Special number” if specialNum is -99, 0, or 44.
#include <stdio.h>
int main(void) {
int specialNum = 0;
specialNum = 17;
if ((specialNum == -99) || (specialNum == 0) || (specialNum == 44)) {
printf("Special number\n");
}
else {
printf("Not special number\n");
}
return 0;
}
Detect number range.
Write an expression that prints “Eligible” if userAge is between 18 and 25 inclusive.
Ex: 17 prints “Ineligible”, 18 prints “Eligible”.
#include <stdio.h>
int main(void) {
int userAge;
userAge = 17;
if ((userAge>=18)&&(userAge<=25)) {
printf("Eligible\n");
}
else {
printf("Ineligible\n");
}
return 0;
}
Use left/right arrows to navigate the slideshow or swipe left/right if using a mobile device