Advertisement
desislava_topuzakova

4. Christmas Presents

Dec 2nd, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Security.Cryptography.X509Certificates;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _05
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15. //налични подаръци: lego, monopoly, puzzle, robot
  16.  
  17. int countKids = int.Parse(Console.ReadLine()); //брой деца
  18.  
  19. int countLego = 0; //брой на лего
  20. int countMonopoly = 0; //брой на монополи
  21. int countPuzzle = 0; //брой на пъзели
  22. int countRobot = 0; //брой на роботи
  23.  
  24. for (int kid = 1; kid <= countKids; kid++)
  25. {
  26. string present = Console.ReadLine(); //поръчан подарък
  27.  
  28. switch (present)
  29. {
  30. case "lego":
  31. countLego++;
  32. break;
  33. case "monopoly":
  34. countMonopoly++;
  35. break;
  36. case "puzzle":
  37. countPuzzle++;
  38. break;
  39. case "robot":
  40. countRobot++;
  41. break;
  42. }
  43. }
  44.  
  45. Console.WriteLine($"Lego: {countLego}");
  46. Console.WriteLine($"Monopoly: {countMonopoly}");
  47. Console.WriteLine($"Puzzles: {countPuzzle}");
  48. Console.WriteLine($"Robots: {countRobot}");
  49.  
  50.  
  51. }
  52. }
  53. }
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement