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());
- if (numberInput > 200)
- {
- sumOfAllP1 += 1;
- }
- else if (numberInput >= 200 && numberInput < 400)
- {
- sumOfAllP2 += 1;
- }
- else if (numberInput >= 400 && numberInput < 600)
- {
- sumOfAllP3 += 1;
- }
- else if (numberInput >= 600 && numberInput < 800)
- {
- sumOfAllP4 += 1;
- }
- else
- {
- sumOfAllP5 += 1;
- }
- }
- double p1 = (sumOfAllP1 / 20 * 100);
- Console.WriteLine("P1 = {0:f2}%", p1);
- double p2 = (sumOfAllP2 / 20 * 100);
- Console.WriteLine("P2 = {0:f2}%", p2);
- double p3 = (sumOfAllP3 / 20 * 100);
- Console.WriteLine("P3 = {0:f2}%", p3);
- double p4 = (sumOfAllP4 / 20 * 100);
- Console.WriteLine("P4 = {0:f2}%", p4);
- double p5 = (sumOfAllP5 / 20 * 100);
- Console.WriteLine("P5 = {0:f2}%", p5);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment