Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NaBatkoZadachite
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. int kids = 0;
  11. int adults = 0;
  12.  
  13. string input = String.Empty;
  14.  
  15. while ((input = Console.ReadLine())!= "Christmas")
  16. {
  17.  
  18.  
  19.  
  20. if (int.Parse(input)<=16)
  21. {
  22. kids++;
  23. }
  24.  
  25. else if (int.Parse(input) > 16)
  26. {
  27. adults++;
  28. }
  29.  
  30. }
  31.  
  32. Console.WriteLine($"Number of adults: {adults}");
  33. Console.WriteLine($"Number of kids: {kids}");
  34. Console.WriteLine($"Money for toys: {kids*5}");
  35. Console.WriteLine($"Number of sweaters: {adults*15}");
  36.  
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement