7
Answers

sum up the numbers on a list

  1. List<int> list = new List<int>();  
  2. while (true)  
  3. {  
  4. int input = Convert.ToInt32(Console.ReadLine());  
  5. if (input == -1)  
  6. {  
  7. break;  
  8. }  
  9. list.Add(input);  
  10. }  
hello a for loop code to add the total sum of this list??
Answers (7)