Fanta-MindTerror

myPow

Dec 24th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             Console.WriteLine("Введите число");
  6.             double N = Convert.ToDouble(Console.ReadLine());
  7.             Console.WriteLine("Введите степень");
  8.             int stepen = Convert.ToInt32(Console.ReadLine());
  9.  
  10.             Console.WriteLine(N + " в "+stepen + " степени " + myPow(N,stepen));
  11.             Console.ReadKey();
  12.         }
  13.  
  14.         static double myPow(double N, int stepen)
  15.         {
  16.             double mnoz = 1;
  17.             for (int i = 1; i <= stepen; i++)
  18.             {
  19.                 mnoz *= N;
  20.             }
  21.             return mnoz;
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment