tsvetelinapasheva

TrekkingMania

Feb 21st, 2021 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp35
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int groupNum = int.Parse(Console.ReadLine());
  10.             int climbingMussala = 0;
  11.             int climbingMonblan = 0;
  12.             int climbingKilimandjaro = 0;
  13.             int climbingK2 = 0;
  14.             int climbingEverest = 0;
  15.             int allPeople = 0;
  16.             for (int i = 1; i <= groupNum; i++)
  17.             {
  18.                 int peopleInGroup = int.Parse(Console.ReadLine());
  19.                 allPeople += peopleInGroup;
  20.                 if (peopleInGroup <= 5)
  21.                 {
  22.                     climbingMussala += peopleInGroup;
  23.                 }
  24.                 else if (peopleInGroup >= 6 && peopleInGroup <= 12)
  25.                 {
  26.                     climbingMonblan += peopleInGroup;
  27.                 }
  28.                 else if (peopleInGroup >= 13 && peopleInGroup <= 25)
  29.                 {
  30.                     climbingKilimandjaro += peopleInGroup;
  31.                 }
  32.                 else if (peopleInGroup >= 26 && peopleInGroup <= 40)
  33.                 {
  34.                     climbingK2 += peopleInGroup;
  35.                 }
  36.                 else if (peopleInGroup >= 41)
  37.                 {
  38.                     climbingEverest += peopleInGroup;
  39.                 }
  40.             }
  41.            
  42.             Console.WriteLine($"{(climbingMussala * 1.0)/allPeople * 100:f2}%");
  43.             Console.WriteLine($"{(climbingMonblan * 1.0) / allPeople * 100:f2}%");
  44.             Console.WriteLine($"{(climbingKilimandjaro * 1.0) / allPeople * 100:f2}%");
  45.             Console.WriteLine($"{(climbingK2 * 1.0) / allPeople * 100:f2}%");
  46.             Console.WriteLine($"{(climbingEverest * 1.0) / allPeople * 100:f2}%");
  47.         }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment