This commit is contained in:
2023-10-03 12:50:05 +01:00
parent cd1d50183b
commit 0fe9a5ef19
5 changed files with 86 additions and 7 deletions

21
C8/ex4.c Normal file
View File

@@ -0,0 +1,21 @@
#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;
}