Teo_Yanchev

Age - C# Fundamentals

Sep 17th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace demo
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int age = int.Parse(Console.ReadLine());
  10.  
  11. string output = string.Empty;
  12. if (0 >= age || age <= 2)
  13. {
  14. output = "baby";
  15. }
  16.  
  17. else if (3 >= age || age <= 13)
  18. {
  19. output = "child";
  20. }
  21.  
  22. else if (14 >= age || age <= 19)
  23. {
  24. output = "teenager";
  25. }
  26.  
  27. else if (20 >= age || age <= 65)
  28. {
  29. output = "adult";
  30. }
  31.  
  32. else if (age >= 66)
  33. {
  34. output = "elder";
  35. }
  36.  
  37. Console.WriteLine(output);
  38. }
  39. }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment