Advertisement
desislava_topuzakova

3

Apr 10th, 2022
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03.NamesGame
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. int maxPoints = int.MinValue;
  11. string winnerWord = "";
  12.  
  13. string name = Console.ReadLine();
  14.  
  15. while (name != "END OF GAME")
  16. {
  17. int points = 0;
  18. char lastLetter = name[name.Length - 1];
  19. if (lastLetter == 'a')
  20. {
  21. points += 10;
  22. }
  23. else if (lastLetter == 'v')
  24. {
  25.  
  26. points += 13;
  27. }
  28. if (name.Length >= 7)
  29. {
  30. points += 33;
  31. }
  32. else
  33. {
  34. points += 22;
  35. }
  36.  
  37. if (points > maxPoints)
  38. {
  39. maxPoints = points;
  40. winnerWord = name;
  41. }
  42.  
  43. name = Console.ReadLine();
  44. }
  45.  
  46. Console.WriteLine($"Winner is name: {winnerWord}");
  47. Console.WriteLine($"Points: {maxPoints}");
  48. }
  49. }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement