Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- public class PowersChallengeNoLoops
- {
- public static void Main()
- {
- int number = int.Parse(Console.ReadLine());
- int power = int.Parse(Console.ReadLine());
- BigInteger result = CalculatePower(1, number, power);
- Console.WriteLine(result);
- }
- private static BigInteger CalculatePower(BigInteger result, int number, int power)
- {
- if (power == 0)
- {
- return result;
- }
- power--;
- result *= number;
- return CalculatePower(result, number, power);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement