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 countNum = int.Parse(Console.ReadLine());
- double Counter0 = 0;
- double Counter200 = 0;
- double Counter400 = 0;
- double Counter600 = 0;
- double Counter800 = 0;
- for (int i=1;i<= countNum;i++)
- {
- double Num = double.Parse(Console.ReadLine());
- if (Num < 200)
- {
- Counter0++;
- }
- else if(Num >= 200&& Num<400)
- {
- Counter200++;
- }
- else if (Num >= 400 && Num < 600)
- {
- Counter400++;
- }
- else if (Num >= 600 && Num < 800)
- {
- Counter600++;
- }
- else if (Num >= 800)
- {
- Counter800++;
- }
- }
- double Procent0 = Counter0 * 100 / countNum;
- double Procent200 = Counter200*100 / countNum;
- double Procent400 = Counter400 * 100 / countNum;
- double Procent600 = Counter600 * 100 / countNum;
- double Procent800 = Counter800 * 100 / countNum;
- Console.WriteLine($"{Procent0:f2}%");
- Console.WriteLine($"{Procent200:f2}%");
- Console.WriteLine($"{Procent400:f2}%");
- Console.WriteLine($"{Procent600:f2}%");
- Console.WriteLine($"{Procent800:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment