+ 3
One of the most common uses of the ReadKey() method is to halt program execution until the user presses a key and the app either terminates or displays an additional window of information. For example i use escape button as a key to terminate while loop. And collect user data with List<int> Check the code. It is written implicitly List<int> d = new List<int>(); while (Console.ReadKey(true).Key != ConsoleKey.Escape) {d.Add(Convert. ToInt32(Console.ReadLine()));}
1st Oct 2020, 6:54 PM
hossein B
hossein B - avatar
+ 1
First one input is for next number of elements.. So with that number of repeatations, run a loop for to take that number of inputs... Edit : Use ReadLine method and cast to Integer..
1st Oct 2020, 11:21 AM
Jayakrishna 🇼🇳