Teo_Yanchev

Methods - MathPower - C# Fundamentals

Sep 10th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _8.MathPower
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double number = double.Parse(Console.ReadLine());
  10. int power = int.Parse(Console.ReadLine());
  11.  
  12. double output = Power(number, power);
  13. Console.WriteLine(output);
  14. }
  15.  
  16. static double Power(double number, int power)
  17. {
  18. double output = 1;
  19. for (int i = 0; i < power; i++)
  20. {
  21. output *= number;
  22. }
  23. return output;
  24. }
  25. }
  26. }
  27.  
Add Comment
Please, Sign In to add comment