Create a C# program that implements a function called Power and calculate the result of raising an integer to another number.
public class FunctionCalculatePowerNumber
public static void Main(string args)
int number = Convert.ToInt32(Console.ReadLine());
int exponent = Convert.ToInt32(Console.ReadLine());
int power = Power(number, exponent);
public static int Power(int number, int exponent)
int result = 1;
for (int i = 0; i < exponent; i++)
result *= number;
Practice C# anywhere with the free app for Android devices.
Learn C# at your own pace, the exercises are ordered by difficulty.
Your donations support our work and contribute to the maintenance of the app.
Own and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.