I'm stuck on this program in this book I'm reading. It basically wants me to write my own Power() method and return the value. If someone knows how to do this. That would be much appreciated. Here's my code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Chapter9Problem7
{
class Program
{
static void Main()
{
int x = 0;
int y = 0;
int result;
Console.Write("\nEnter BASE: ");
x = Convert.ToInt32(Console.ReadLine());
Console.Write("\nEnter EXPONENT: ");
y = Convert.ToInt32(Console.ReadLine());
result = Power(x,y);
Console.Write("\nBASE:{0} EXPONENT:{1} = {2}", x, y, result);
}
static int Power(int x, int y)
{
for (int i = 1; i <= y; i++)
return
}
}
}
I can't figure out the return part of it so I just left it That's where I'm stuck at