MuffinMonster

Class Task 15#

Oct 23rd, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int a, n, total;
  13.             a = int.Parse(Console.ReadLine());
  14.             n = int.Parse(Console.ReadLine());
  15.             total = a;
  16.             if (n == 0)
  17.             {
  18.                 total = 1;
  19.             }
  20.             else
  21.             {
  22.                 for (n = n - 1; n > 0; n--)
  23.                 {
  24.                     total = total * a;
  25.                 }
  26.             }
  27.             Console.WriteLine(total);
  28.             Console.ReadLine();
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment