Example of how to square a number by using a method.
static int Square(int n)
{
return n *= n;
}
static void Main(string[] args)
{
Console.Write("Enter the number you want to square: ");
int num = Int32.Parse(Console.ReadLine());
Console.WriteLine(Square(num));
}
// Enter the number you want to square: 5
// 25