fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int birth_year, current_year, age, gender;
  5.  
  6.  
  7. printf("2009: ");
  8. scanf("%d", &birth_year);
  9.  
  10.  
  11. printf("2024: ");
  12. scanf("%d", &current_year);
  13. printf("0 (0 boy, 1 gril: ");
  14. scanf("%d", &gender);
  15.  
  16. age = current_year - birth_year;
  17.  
  18.  
  19. if (age >= 40) {
  20. if (gender == 0) {
  21. printf("Adult Male\n");
  22. } else if (gender == 1) {
  23. printf("Adult Female\n");
  24. }
  25. } else if (age >= 15) {
  26. printf("Teens\n");
  27. } else {
  28. printf("Child\n");
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
2009: 2024: 0 (0 boy, 1 gril: