+ 1
How to create a program that can loop into 10 with input of user 10 times. Then the output is 10 writeline
loop with concatinate?
3 Answers
+ 2
... Foreach loops....
// init variables. Array and int counter
string[] inputsArr = new string[11];
int counter = 0;
// For loop to ask 10 times
// Init int x, check if x equal to 10, then increase x by one.
for (int x = 1; x <= 10; x++)
{
Console.Write("Input: ");
string input = Console.ReadLine();
// Store input to next 'cell'
inputsArr[0] = input;
}
int counter = 0;
foreach (string inputs in inputsArr)
{
counter++;
Console. WriteLine(inputs);
}
Console.ReadKey();
Tested in Visual Studio 2015 Community. C# 3.0
0
Use List<T>
- 1
without using array?