Thread: User Input help
View Single Post
Old 11-28-2012, 11:20 AM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 129
Thanks: 1
Thanked 31 Times in 31 Posts
niralsoni is an unknown quantity at this point
First, initialise your variable to zero
Code:
double runningtot = 0.00;
Then, in the for loop, keep on adding the amount rather then updating it.
Code:
runningtot += price;
Hope this helps you out...

Regards,
Niral Soni
niralsoni is offline   Reply With Quote