Advertisement
AmirVagapov

Pow using sum

Apr 2nd, 2023
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. class Program {
  4.  public static int Main() {
  5.      
  6.   Console.Write("Введите число  : ");
  7.   int num = int.Parse(Console.ReadLine());
  8.  
  9.   Console.Write("Введите степень    : ");
  10.   int n = int.Parse(Console.ReadLine());
  11.  
  12.    int c = num, f = num;
  13.     for(int i = 1; i < n; i++){
  14.         for(int j = 1 ; j < num; j++){
  15.             c = c + f;
  16.         }
  17.         f = c;
  18.     }
  19.   Console.WriteLine("{0} ^ {1} = {2}", num, n, f);
  20.   Console.ReadKey();
  21.   return 0;
  22.  }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement