Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06.NameGame
- {
- class NameGame
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int bestPoints = 0;
- string win = "";
- while (name != "Stop")
- {
- int currentPoints = 0;
- for (int i = 0; i < name.Length; i++)
- {
- int number = int.Parse(Console.ReadLine());
- if (number == name[i])
- {
- currentPoints += 10;
- }
- else
- {
- currentPoints += 2;
- }
- }
- if (currentPoints >= bestPoints)
- {
- bestPoints = currentPoints;
- win = name;
- }
- name = Console.ReadLine();
- }
- Console.WriteLine($"The winner is {win} with {bestPoints} points!");
- }
- }
- }
Add Comment
Please, Sign In to add comment