More if-else

If-else statements.

Write multiple if statements:
If carYear is before 1967, print “Probably has few safety features.” (without quotes).
If after 1969, print “Probably has seat belts.”.
If after 1991, print “Probably has electronic stability control.”.
If after 2000, print “Probably has tire-pressure monitor.”.
End each phrase with period and newline. Ex: carYear = 1995 prints:

 

Probably has seat belts.
Probably has electronic stability control.
#include <stdio.h>

int main(void) {
 int carYear;

carYear = 2001;

if(carYear < 1967){
 printf("Probably has few features.\n");
 }
 if(carYear > 1969){
 printf("Probably has seat belts.\n");
 }
 if(carYear > 1991){
 printf("Probably has electronic stability control.\n");
 }
 if(carYear > 2000){
 printf("Probably has tire-pressure monitor.\n");
 }
 
 return 0;
}

Write multiple if statements:
If carYear is before 1968, print “Probably has few safety features.” (without quotes).
If after 1969, print “Probably has head rests.”.
If after 1990, print “Probably has anti-lock brakes.”.
If after 2000, print “Probably has tire-pressure monitor.”.
End each phrase with period and newline. Ex: carYear = 1995 prints:

Probably has head rests.

Probably has anti-lock brakes.

#include <stdio.h>

int main(void) {
 int carYear;

carYear = 2006;

if(carYear < 1968){
 printf("Probably has few safety features.\n");
 }
 if(carYear > 1969){
 printf("Probably has head rests.\n");
 }
 if(carYear > 1990){
 printf("Probably has anti-lock brakes.\n");
 }
 if(carYear > 2000){
 printf("Probably has tire-pressure monitor.\n");
 }

return 0;
}

Print “userNum1 is negative.” if userNum1 is less than 0. End with newline.
Convert userNum2 to 0 if userNum2 is greater than 11. Otherwise, print “userNum2 is less than or equal to 11.”. End with newline.

#include <stdio.h>

int main(void) {
 int userNum1;
 int userNum2;

userNum1 = 1;
 userNum2 = 13;

if(userNum1 < 0){
 printf("userNum1 is negative.\n"); 
 }
 
 if(userNum2 > 11){
 userNum2 = 0;
 }
 
else{
 printf("userNum2 is less than or equal to 11.");
 }

printf("userNum2 is %d.\n", userNum2);

return 0;
}