Histogram - For Loop- задача от упражненията. Може ли корекция на решението
using System;
namespace ConsoleApp2
{
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;
double counter = 0;
for (int i = 1; i < n; i++)
{
int number = int.Parse(Console.ReadLine());
if (number < 200)
{
p1 = counter / 20 * 100;
counter += 1;
}
else if (number < 399)
{
p2 = counter / 20 * 100;
counter += 1;
}
else if (number < 599)
{
p3 = counter / 20 * 100;
counter += 1;
}
else if (number < 799)
{
p4 = counter / 20 * 100;
counter += 1;
}
else if (number < 1000)
{
p5 = counter / 20 * 100;
counter += 1;
}
}
Console.WriteLine($"(p1:f2)%, (p2:f2)%, (p3:f2)%, (p4:f2)%, (p5:f2)%", p1, p2, p3, p4, p5);
}
}
}