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 _13_exam1_histogram
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double count1 = 0.0;
- double count2 = 0.0;
- double count3 = 0.0;
- double count4 = 0.0;
- double count5 = 0.0;
- for (int i = 0; i < n; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num < 200)
- {
- count1++;
- }
- else if (200 <= num && num < 400)
- {
- count2++;
- }
- else if (400 <= num && num < 600)
- {
- count3++;
- }
- else if (600 <= num && num < 800)
- {
- count4++;
- }
- else
- {
- count5++;
- }
- }
- double p1 = (count1 / n) * 100.0;
- double p2 = (count2 / n) * 100.0;
- double p3 = (count3 / n) * 100.0;
- double p4 = (count4 / n) * 100.0;
- double p5 = (count5 / n) * 100.0;
- Console.WriteLine($"{p1:f2}%");
- Console.WriteLine($"{p2:f2}%");
- Console.WriteLine($"{p3:f2}%");
- Console.WriteLine($"{p4:f2}%");
- Console.WriteLine($"{p5:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement