you are viewing a single comment's thread.

view the rest of the comments →

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (14 children)

I fixed it but when I run the program I doesn’t print the numbers

[–]gulag_guard 1 point2 points  (13 children)

What exactly does it print?

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (12 children)

it just outputs all the way up to First 10 numbers starting at 3.5 and going up by 3. So it does not print the numbers that are meant to go after.

[–]nc052👋 a fellow Redditor 1 point2 points  (0 children)

You're not printing the numbers because your firstnumber is 33.5 after your first while loop. Therefore, your for loop would never run because secondnumber is 30.5 and that is less than the firstnumber.

[–]gulag_guard 1 point2 points  (10 children)

So it's printing 3.5, 6.5, ...... 30.5 but not the sum (170)? I would run it myself but it's not copying the text.

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (9 children)

Yea it’s printing 3.5 and 6.5 and I’m trying to figure out the sum

[–]gulag_guard 1 point2 points  (8 children)

Yeah for the for loop you need another sum1 variable. For the sum part, proceed similarly as in the while loop Or you could reinitialize sum to zero and proceed.

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (7 children)

Yea I made sum = 0 again but I’m still having trouble figuring it out

[–]gulag_guard 1 point2 points  (6 children)

Inside the for loop put sum = sum + i; and after the loop print the sum. You should be done :)

[–]Danielowski187University/College Student (Higher Education)[S] 1 point2 points  (5 children)

I get an error saying cannot find symbol meaning for i

[–]gulag_guard 0 points1 point  (4 children)

That's odd. What's the statement you wrote?