How do i use loops to find the some of numbers taking from an external file.
I already have the numbers listed on the screen, but i can't figure out how to show the sum of the numbers after the list.
Please help
How do i use loops to find the some of numbers taking from an external file.
I already have the numbers listed on the screen, but i can't figure out how to show the sum of the numbers after the list.
Please help
You have the numbers listed on the screen. So you know how to read them from the file. The only thing you need to do is after each time you've read a number, update a sum-variable. Such like this:
Code:sum = 0 while not end of file number = read number () sum = sum + number