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