rating.c 775 Bytes
//#include <stdbool.h>
#include <stdio.h>
int main() {
char rate;
int age = 0;
//bool suit = false;
printf("Enter the movie rating (G, P, or R): ");
scanf("%c", &rate);
printf("How old are you? ");
scanf("%d", &age);
printf("%s\n", (rate=='G' || (rate=='P' && age>=13) ||
(rate=='R' && age >= 17)) ? "Suitable movie. Enjoy!" :
"Unsuitable movie. Enjoy the review!");
/*
if (rate == 'G') {
suit = true;
}
else if (rate == 'P' && age >= 13) {
suit = true;
}
else if (rate == 'R' && age >= 17) {
suit = true;
}
else {
suit = false;
}
if (suit)
printf("Suitable movie. Enjoy!\n");
else
printf("Unsuitable movie. Enjoy the review!\n");
*/
return 0;
}