but as for your first point about the 'while (data!=0)' statement, my code asks it to ADD the value to a variable and end the loop but considering that the value is 0 it shouldn't affect my loop. So I don't understand why that would make a difference in my code. Am I missing something? I don't understand why you would point that part of the code out.
What I'm pointing out is just to initialize your
data variable to a number not equal to zero. Why? just to make sure that the while loop executes at least once. Actually you did it in your code, but you ask this question in your first post:
Also i have a quick question, the program needs me to end the program when the value of data is 0 but in order to initialize it I need to give it a value. Usually I would give it a value of 0 like I have for rangesum and outrangesum but if I do the program does not run till the loop as it considers the value of data to be 0 and ends the program right away.
or maybe I just did not understand what you are pointing out with that question that is why I ended up with a suggestion that made you confused. sorry, actually, I am not good in english.