C# - Find the power; a number raise to the power of another number
C# - Find the power; a number raise to the power of another number
CODE
using System;
class Program
{
static void Main(string[] args)
{
int number = 10;
int raiseTo = 3;
int power = 1;
for(int i = 1; i <= raiseTo; i++)
{
power = power * number;
}
Console.WriteLine(number + " ^ " + raiseTo + " = " + power);
// Output
// 10 ^ 3 = 1000
}
}
Comments
Post a Comment