Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Math_Power
- {
- class Program
- {
- static double CalculatePower(double numValue, int powValue)
- {
- if (powValue==1)
- {
- return numValue;
- }
- else
- {
- return numValue*CalculatePower(numValue, powValue - 1);
- }
- }
- static void Main()
- {
- double number = double.Parse(Console.ReadLine());
- int power = int.Parse(Console.ReadLine());
- double result = CalculatePower(number, power);
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement