Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Odd_Even_Position
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine(); //vuvejdame imeto
- int sum = 0;
- int nameMax = 0;
- string winner = "";
- while (name != "STOP")
- {
- for (int i = 0; i < name.Length; i++) //minavame prez vsqka bukva
- {
- char letter = name[i];
- sum += (int)letter;
- }
- if (sum > nameMax)
- {
- nameMax = sum;
- winner = name;
- }
- sum = 0;
- name = Console.ReadLine();
- }
- Console.WriteLine($"Winner is {winner} - {nameMax}!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement