using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class PowerProg
{
private static int Power (int a, int n)
{
int res = 1;
for (int i = 0; i < n; i++)
{
res *= a;
}
return res;
}
static void Main ()
{
System.Console.Write ("Input a: ");
int a = int.Parse(System.Console.ReadLine ());
System.Console.Write ("Input n: ");
int n = int.Parse(System.Console.ReadLine());
System.Console.WriteLine("a^n = " + Power(a, n).ToString());
System.Console.ReadKey ();
}
}
Comments
Leave a comment