Using System;
class Program
{
public static void Main()
{
double a, an = 1, s = 1;
int n;
Console.Write("a = ");
a = double.Parse(Console.ReadLine());
Console.Write("n = ");
n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)<br> {
an = an*a;
s += an;
}
Console.WriteLine("s = {0}", s);
Console.ReadKey();
}
}
Пример:
a = 2
n = 5
s = 63