Reputation: 11
I have already asked the user to enter the amount but i am strugling to store them into an array. This is what i have done so far.Please help. I am a beginner.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int intNum;
Console.WriteLine("How many integers must be stored in the program?");
intNum = Convert.ToInt32(Console.ReadLine());
}
}
}
Upvotes: 1
Views: 116
Reputation: 1500275
Well, the next step is probably to create the array (assuming you really want to use an array; it's easy to do in this case, but you could also consider using a List<int>
which doesn't require you to know the size up-front).
Then you need to loop intNum
times, ask the user for a number each time, parse it, and store it in the array.
That's several little steps. I'm not going to give you the complete code, but if you show how you're progressing and which step is causing you problems, we can try to help you further.
Upvotes: 5