This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/C8/ex4.c

22 lines
409 B
C
Raw Normal View History

2023-10-03 11:50:05 +00:00
#include <stdio.h>
int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);
// c only matches one branch so don't need to specify lower limits of each age range
if ( age <= 0 ) {
printf("Still a baby\n");
} else if ( age <= 12 ) {
printf("The junior years\n");
} else if ( age < 20 ) {
printf("Teenage years\n");
} else {
printf("Downhill all the way now!\n");
}
return 0;
}