Advertisement
KristianIvanov00

Task01_Homework4

Mar 12th, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task01
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. String EGN = Console.ReadLine();
  10. int year = int.Parse(EGN.Substring(0, 2));
  11. int month = int.Parse(EGN.Substring(2, 2));
  12.  
  13. if (month > 20 && month <= 32)
  14. {
  15. year += 1800;
  16. }
  17. else if (month > 40 && month <= 52)
  18. {
  19. year += 2000;
  20. }
  21. else
  22. {
  23. year += 1900;
  24. }
  25.  
  26. int age = 2019 - year;
  27. if (age >= 18)
  28. {
  29. Console.WriteLine("adult");
  30. }
  31. else
  32. {
  33. Console.WriteLine("juvenile");
  34. }
  35. }
  36. }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement