Guest User

Untitled

a guest
Nov 24th, 2019
284
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 _06._Name_Wars
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string name = Console.ReadLine();
  10. int max = int.MinValue;
  11. string maxname = " ";
  12. int sum = 0;
  13. while (name != "STOP")
  14. {
  15. sum = 0;
  16.  
  17. for (int i = 0; i < name.Length; i++)
  18. {
  19. char letter = name[i];
  20. sum += letter;
  21.  
  22.  
  23. }
  24. if (sum > max)
  25. {
  26. max = sum;
  27. maxname = name;
  28. }
  29. name = Console.ReadLine();
  30. }
  31. Console.WriteLine($" Winner is {maxname} - { max}!");
  32.  
  33.  
  34.  
  35.  
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment