Yanislav29

Untitled

Nov 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string name = Console.ReadLine();
  14. int max = int.MinValue;
  15. string maxname = " ";
  16. int sum = 0;
  17. while (name != "STOP")
  18. {
  19.  
  20. for (int i = 0; i < name.Length; i++)
  21. {
  22. char letter = name[i];
  23. sum += letter;
  24.  
  25.  
  26. }
  27. if (sum > max)
  28. {
  29. max = sum;
  30. maxname = name;
  31. }
  32. name = Console.ReadLine();
  33. }
  34. Console.WriteLine($" Winner is {maxname} - { max}!");
  35.  
  36.  
  37.  
  38.  
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment