WAP to accept two number from user & Using while loop calculate A power B.
using System;
using System.Text;
namespace PowerOfNumber
{
class Program
{
static void Main(string[] args)
{
int num1, num2;
int power = 1;
int i = 1;
Console.WriteLine("Enter a number:");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter a power number:");
num2 = Convert.ToInt32(Console.ReadLine());
while (i<= num2)
{
power = power * num1;
i = i + 1;
}
Console.WriteLine(num1 + " 's Power " +num2 + " is : " +power + " .!");
Console.ReadKey();
}
}
}
No comments:
Post a Comment