Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp9
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- double p1 = 0;
- double p2 = 0;
- double p3 = 0;
- double p4 = 0;
- double p5 = 0;
- for (int i = 0; i < n; i++)
- {
- var number = int.Parse(Console.ReadLine());
- if (number < 200)
- {
- p1 += 1;
- }
- else if (number < 400)
- {
- p2 += 1;
- }
- else if (number < 600)
- {
- p3 += 1;
- }
- else if (number < 800)
- {
- p4 += 1;
- }
- else if (number < 1000)
- {
- p5 += 1;
- }
- }
- double p1Percent = p1 / n * 100;
- double p2Percent = p2 / n * 100;
- double p3Percent = p3 / n * 100;
- double p4Percent = p4 / n * 100;
- double p5Percent = p5 / n * 100;
- Console.WriteLine(Math.Round(p1Percent, 2) + "%");
- Console.WriteLine(Math.Round(p2Percent, 2) + "%");
- Console.WriteLine(Math.Round(p3Percent, 2) + "%");
- Console.WriteLine(Math.Round(p4Percent, 2) + "%");
- Console.WriteLine(Math.Round(p5Percent, 2) + "%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement