Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNoah Agius
1,809 Pointsnothing I try is working! I need help urgently.
Please!
int mathTotal;
bool isComplete;
for (int i = 5; i <= 25 ; i++) {
mathTotal = i;
isComplete = true;
}
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! There's a couple of problems. First, you're resetting your mathTotal every iteration through the loop. It's expecting to have mathTotal keep a running total. So the first iteration it will be 5. The second it will be 5 + 6 (11). The third it will be 11 + 7 (18) etc.
Second, it wants you to set isComplete to true
after the loop has completed. Currently, you're doing so in every iteration of the loop. Take a look:
int mathTotal;
bool isComplete;
for (int i = 5; i <= 25 ; i++) {
mathTotal += i;
}
isComplete = true;
Hope this helps!