Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp35
- {
- class Program
- {
- static void Main(string[] args)
- {
- int groupNum = int.Parse(Console.ReadLine());
- int climbingMussala = 0;
- int climbingMonblan = 0;
- int climbingKilimandjaro = 0;
- int climbingK2 = 0;
- int climbingEverest = 0;
- int allPeople = 0;
- for (int i = 1; i <= groupNum; i++)
- {
- int peopleInGroup = int.Parse(Console.ReadLine());
- allPeople += peopleInGroup;
- if (peopleInGroup <= 5)
- {
- climbingMussala += peopleInGroup;
- }
- else if (peopleInGroup >= 6 && peopleInGroup <= 12)
- {
- climbingMonblan += peopleInGroup;
- }
- else if (peopleInGroup >= 13 && peopleInGroup <= 25)
- {
- climbingKilimandjaro += peopleInGroup;
- }
- else if (peopleInGroup >= 26 && peopleInGroup <= 40)
- {
- climbingK2 += peopleInGroup;
- }
- else if (peopleInGroup >= 41)
- {
- climbingEverest += peopleInGroup;
- }
- }
- Console.WriteLine($"{(climbingMussala * 1.0)/allPeople * 100:f2}%");
- Console.WriteLine($"{(climbingMonblan * 1.0) / allPeople * 100:f2}%");
- Console.WriteLine($"{(climbingKilimandjaro * 1.0) / allPeople * 100:f2}%");
- Console.WriteLine($"{(climbingK2 * 1.0) / allPeople * 100:f2}%");
- Console.WriteLine($"{(climbingEverest * 1.0) / allPeople * 100:f2}%");
- }
- }
- }
Add Comment
Please, Sign In to add comment