This repository was archived by the owner on Mar 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
55 lines (52 loc) · 1.65 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
namespace TrekkingMania
{
internal class Program
{
static void Main(string[] args)
{
int numberOfGroups = int.Parse(Console.ReadLine());
int numberOfPpl = 0;
double pMusala = 0;
double pMonblan = 0;
double pKili = 0;
double pKtwo = 0;
double pEverest = 0;
for (int i = 1; i <= numberOfGroups; i++)
{
int pplInGroups = int.Parse(Console.ReadLine());
numberOfPpl += pplInGroups;
if (pplInGroups <= 5)
{
pMusala += pplInGroups;
}
else if (pplInGroups <= 12)
{
pMonblan += pplInGroups;
}
else if (pplInGroups <= 25)
{
pKili += pplInGroups;
}
else if (pplInGroups <=40)
{
pKtwo += pplInGroups;
}
else
{
pEverest += pplInGroups;
}
}
pMusala = pMusala / numberOfPpl * 100.0;
pMonblan = pMonblan / numberOfPpl * 100.0;
pKili = pKili / numberOfPpl * 100.0;
pKtwo = pKtwo / numberOfPpl * 100.0;
pEverest = pEverest / numberOfPpl * 100.0;
Console.WriteLine($"{pMusala:f2}%");
Console.WriteLine($"{pMonblan:f2}%");
Console.WriteLine($"{pKili:f2}%");
Console.WriteLine($"{pKtwo:f2}%");
Console.WriteLine($"{pEverest:f2}%");
}
}
}