taks kamps

taks kamps

  • NA
  • 39
  • 7k

declaring a method

Dec 15 2018 2:18 AM
im trying to write a method called Power that takes two non-negative integer parameters and returns a value that is the first parameter raised to the power of the second (e.g. parameters 2, 3 will return 8, which is 2 x 2 x 2).
 
 
using System;

namespace HelloWorld
{
class Program
{

static void Main(string[] args)
{
int a = 2;
int b = 3;
int result = Power(a, b);
Console.WriteLine(result);
}
}
}

Answers (2)