+ 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?

25th Nov 2016, 3:21 AM
Joven Patungan
Joven Patungan - avatar
3 Respostas
+ 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
25th Nov 2016, 4:44 AM
Newuser Noob
Newuser Noob - avatar
0
Use List<T>
2nd Dec 2016, 8:11 AM
acpa
- 1
without using array?
26th Nov 2016, 2:07 AM
Joven Patungan
Joven Patungan - avatar