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 _06.Histogram
- {
- class Program
- {
- static void Main(string[] args)
- {
- double n = double.Parse(Console.ReadLine());
- double counter1 = 0;
- double counter2 = 0;
- double counter3 = 0;
- double counter4 = 0;
- double counter5 = 0;
- for (int i = 0; i < n; i++)
- {
- double num = double.Parse(Console.ReadLine());
- if (num<200)
- {
- counter1++;
- }
- else if (num >= 200 && num <= 399)
- {
- counter2++;
- }
- else if (num >= 400 && num <= 599)
- {
- counter3++;
- }
- else if (num >= 600 && num <= 799)
- {
- counter4++;
- }
- else
- {
- counter5++;
- }
- }
- Console.WriteLine("{0:F2}%", counter1 / n * 100);
- Console.WriteLine("{0:F2}%", counter2 / n *100);
- Console.WriteLine("{0:F2}%", counter3 / n * 100);
- Console.WriteLine("{0:F2}%", counter4 / n * 100);
- Console.WriteLine("{0:F2}%", counter5 / n * 100);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement