using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Power { class Program { static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.Cyan; string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int c = 1; while (b1 != 0) { c = c * a1; b1 = b1 - 1;} Console.WriteLine("result:" + c.ToString()); Console.ReadKey(); } } }
تصویر خروجی برنامه ی توان(Power):