Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace practice
- {
- class Program
- {
- public static void Main(string[] args)
- {
- ushort countNumbers = ushort.Parse(Console.ReadLine());
- ushort sumOfAllP1 = 0;
- ushort sumOfAllP2 = 0;
- ushort sumOfAllP3 = 0;
- ushort sumOfAllP4 = 0;
- ushort sumOfAllP5 = 0;
- for (int i=0; i<countNumbers; i++)
- {
- ushort numberInput = ushort.Parse(Console.ReadLine());
- switch (numberInput)
- {
- case (numberInput > 0 && numberInput < 200): sumOfAllP1 += 1 ; break;
- case (numberInput >= 200 && numberInput < 400): sumOfAllP2 += 1 ; break;
- case (numberInput >= 400 && numberInput < 600): sumOfAllP3 += 1 ; break;
- case (numberInput >= 600 && numberInput < 800): sumOfAllP4 += 1 ; break;
- case (numberInput >= 800 && numberInput < 1000): sumOfAllP5 += 1 ; break;
- }
- }
- Console.WriteLine("P1 = {0:f2}%", (sumOfAllP1 / 20 * 100));
- Console.WriteLine("P2 = {0:f2}%", (sumOfAllP2 / 20 * 100));
- Console.WriteLine("P3 = {0:f2}%", (sumOfAllP3 / 20 * 100));
- Console.WriteLine("P4 = {0:f2}%", (sumOfAllP4 / 20 * 100));
- Console.WriteLine("P5 = {0:f2}%", (sumOfAllP5 / 20 * 100));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement