Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. string aStr = Console.ReadLine();
  8. string nStr = Console.ReadLine();
  9.  
  10. int a = int.Parse(aStr);
  11. int n = int.Parse(nStr);
  12.  
  13. int sum = 1;
  14.  
  15. for(int i = 1; i <= n; i++)
  16. {
  17. sum = sum + a;
  18. a = a*a;
  19. }
  20.  
  21. Console.WriteLine(sum);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement