Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int gamesCount = int.Parse(Console.ReadLine());
- string command = "";
- int hearth = 0;
- int fornite = 0;
- int overwatch = 0;
- int others = 0;
- for (int i = 0; i < gamesCount; i++)
- {
- command = Console.ReadLine();
- if (command == "Hearthstone")
- {
- hearth++;
- }
- else if (command == "Fornite")
- {
- fornite++;
- }
- else if (command == "Overwatch")
- {
- overwatch++;
- }
- else
- {
- others++;
- }
- }
- double hearthPercent = (hearth * 1.0 / gamesCount) * 100.0;
- double fornitePercent = (fornite * 1.0 / gamesCount) * 100.0;
- double overwatchPercent = overwatch * 1.0 / gamesCount * 100.0;
- double othersPercent = others * 1.0 / gamesCount * 100.0;
- Console.WriteLine($"Hearthstone - {hearthPercent:f2}%");
- Console.WriteLine($"Fornite - {fornitePercent:f2}%");
- Console.WriteLine($"Overwatch - {overwatchPercent:f2}%");
- Console.WriteLine($"Others - {othersPercent:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement