Mngaro Mwazenje

Mngaro Mwazenje

  • NA
  • 80
  • 12.2k

sum up the numbers on a list

Feb 14 2020 4:35 AM
  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)