1
Answer

how to locate numbers in a list if u input the numbers??

the code i need is to print out the numbers when i input from where....to where!! ....noob here
  1. public static void Main(string[] args)  
  2. {  
  3. List<int> list = new List<int>();  
  4. while (true)  
  5. {  
  6. int input = Convert.ToInt32(Console.ReadLine());  
  7. if (input == -1)  
  8. {  
  9. break;  
  10. }  
  11. list.Add(input);  
  12. }  
  13. Console.WriteLine("From where");  
  14. int number = Convert.ToInt32(Console.ReadLine());  
  15. Console.WriteLine("To where");  
  16. int number2 = Convert.ToInt32(Console.ReadLine());  
  17. for (int i = 0; i < list.Count; i++)  
  18. Console.WriteLine(i);  
Answers (1)