I am not grasping this exercise; Please help with some explanations.
Q: Write a method that accepts an array of numbers as a parameter. The method should multiply each number by five, and display the results. Call this method, passing to it an array of any three integers.
THIS IS WHAT I HAVE ATTEMPTED!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RandomNumber
{
public class Program
{
int result = 0;
public Program()
{
//Declare the Array
int[] numArray = new int[3];
//Using a for loop to display the contents of the array
for (int loop = 0; loop < 3; loop++)
{
Console.WriteLine("Please enter a number");
numArray[loop] = Int32.Parse(Console.ReadLine());
Console.WriteLine(numArray[loop] * 5);
}
}
public void receiveNumbers(int[] numbers) //this method accepts the array(the value)
{
for (int loop = 0; loop < 3; loop++)
{
result = int[loop] * 5; // how do I store each element's new result?
Console.WriteLine(result);
}
}
public static void Main(string[] args)
{
Program p = new Program();
p.receiveNumbers(numArray); // what do I put inside the parameters?
}
}
}