main();
static void main()
{
chisla chisla = new chisla();
chisla.main1();
chisla.resultWrite();
}
class chisla
{
static int N = 0;
static int k = 0;
static int count = 0;
static public int result = 0;
public void main1()
{
try
{
Console.WriteLine("Введите значение N: ");
chisla.N = int.Parse(Console.ReadLine());
Console.WriteLine("Введите значение k: ");
chisla.k = int.Parse(Console.ReadLine());
Console.WriteLine("Введите количество итераций: ");
chisla.count = int.Parse(Console.ReadLine());
chisla.result = rashet(chisla.N, chisla.k, chisla.count);
}
catch (Exception e)
{
Console.WriteLine("Введите именно число");
}
}
public void resultWrite()
{
Console.WriteLine("Результат: " + chisla.result.ToString());
}
static int rashet(int N, int k, int count)
{
int vremresult = 0;
int vremcount = 1;
int result = 0;
while (count > 0)
{
vremresult = (vremcount * k);
result = (result + vremresult);
vremresult = 0;
vremcount++;
count--;
};
result = (result + (N*k));
return result;
}
}