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 ConsoleApp37
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double p1 = 0;
- double p2 = 0;
- double p3 = 0;
- double p4 = 0;
- double p5 = 0;
- for (int i = 1; i <= n; i++)
- {
- int num = int.Parse(Console.ReadLine());
- if (num<=199)
- {
- p1=p1+1;
- }
- else if (num<=399)
- {
- p2 = p2 + 1;
- }
- else if (num<=599)
- {
- p3 = p3 + 1;
- }
- else if (num <=799)
- {
- p4 = p4 + 1;
- }
- else
- {
- p5 = p5 + 1;
- }
- }
- p1 = p1 / n * 100;
- p2 = p2 / n * 100;
- p3 = p3 / n * 100;
- p4 = p4 / n * 100;
- p5 = p5 / n * 100;
- 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