Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Histogram
- {
- class Program
- {
- static void Main(string[] args)
- {
- double N = double.Parse(Console.ReadLine());
- double input = 0.0;
- int p1 = 0;
- int p2 = 0;
- int p3 = 0;
- int p4 = 0;
- int p5 = 0;
- for (int i = 0; i < N; i++)
- {
- input = double.Parse(Console.ReadLine());
- if (input < 200)
- {
- p1++;
- }
- else if (input >= 200 && input <= 399)
- {
- p2++;
- }
- else if (input >= 400 && input <= 599)
- {
- p3++;
- }
- else if (input >= 600 && input <= 799)
- {
- p4++;
- }
- else if (input >= 800)
- {
- p5++;
- }
- }
- Console.WriteLine($"{(p1 / N) * 100:f2}%");
- Console.WriteLine($"{(p2 / N) * 100:f2}%");
- Console.WriteLine($"{(p3 / N) * 100:f2}%");
- Console.WriteLine($"{(p4 / N) * 100:f2}%");
- Console.WriteLine($"{(p5 / N) * 100:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement