c8
This commit is contained in:
21
C8/ex4.c
Normal file
21
C8/ex4.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user