Enter your variable:
5
Enter your power:
3
125
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Powers
{
class Program
{
static void Main(string[] args)
{
power();
}
private static void power()
{
while (1 == 1)
{
Console.WriteLine("Enter your variable: ");
double x = double.Parse(Console.ReadLine());
Console.WriteLine("Enter your power: ");
double y = double.Parse(Console.ReadLine());
double z = x;
for (int i = 1; i < y; i++)
{
z = x * z;
}
Console.WriteLine(z);
string a = Console.ReadLine();
}
}
}
}
No comments:
Post a Comment