Knute Snortum wrote:A really good rule is to never leave the braces off of blocks like while, do, and if. Put braces on your while loop and run it. If it doesn't work, post your new code and what exactly happens or doesn't happen.
I think that fixed it. Forgetting the {} changed it. Can't believe I missed it.
This was my task:
While loop counts from 1 to 100
Total (5050) computed correctly
Here's the output:
The sum of the number 1 - 100 is
1
The sum of the number 1 - 100 is
2
The sum of the number 1 - 100 is
3
The sum of the number 1 - 100 is
4
The sum of the number 1 - 100 is
5
The sum of the number 1 - 100 is
6
The sum of the number 1 - 100 is
7
The sum of the number 1 - 100 is
8
The sum of the number 1 - 100 is
9
The sum of the number 1 - 100 is
10
The sum of the number 1 - 100 is
11
The sum of the number 1 - 100 is
12
The sum of the number 1 - 100 is
13
The sum of the number 1 - 100 is
14
The sum of the number 1 - 100 is
15
The sum of the number 1 - 100 is
16
The sum of the number 1 - 100 is
17
The sum of the number 1 - 100 is
18
The sum of the number 1 - 100 is
19
The sum of the number 1 - 100 is
20
The sum of the number 1 - 100 is
21
The sum of the number 1 - 100 is
22
The sum of the number 1 - 100 is
23
The sum of the number 1 - 100 is
24
The sum of the number 1 - 100 is
25
The sum of the number 1 - 100 is
26
The sum of the number 1 - 100 is
27
The sum of the number 1 - 100 is
28
The sum of the number 1 - 100 is
29
The sum of the number 1 - 100 is
30
The sum of the number 1 - 100 is
31
The sum of the number 1 - 100 is
32
The sum of the number 1 - 100 is
33
The sum of the number 1 - 100 is
34
The sum of the number 1 - 100 is
35
The sum of the number 1 - 100 is
36
The sum of the number 1 - 100 is
37
The sum of the number 1 - 100 is
38
The sum of the number 1 - 100 is
39
The sum of the number 1 - 100 is
40
The sum of the number 1 - 100 is
41
The sum of the number 1 - 100 is
42
The sum of the number 1 - 100 is
43
The sum of the number 1 - 100 is
44
The sum of the number 1 - 100 is
45
The sum of the number 1 - 100 is
46
The sum of the number 1 - 100 is
47
The sum of the number 1 - 100 is
48
The sum of the number 1 - 100 is
49
The sum of the number 1 - 100 is
50
The sum of the number 1 - 100 is
51
The sum of the number 1 - 100 is
52
The sum of the number 1 - 100 is
53
The sum of the number 1 - 100 is
54
The sum of the number 1 - 100 is
55
The sum of the number 1 - 100 is
56
The sum of the number 1 - 100 is
57
The sum of the number 1 - 100 is
58
The sum of the number 1 - 100 is
59
The sum of the number 1 - 100 is
60
The sum of the number 1 - 100 is
61
The sum of the number 1 - 100 is
62
The sum of the number 1 - 100 is
63
The sum of the number 1 - 100 is
64
The sum of the number 1 - 100 is
65
The sum of the number 1 - 100 is
66
The sum of the number 1 - 100 is
67
The sum of the number 1 - 100 is
68
The sum of the number 1 - 100 is
69
The sum of the number 1 - 100 is
70
The sum of the number 1 - 100 is
71
The sum of the number 1 - 100 is
72
The sum of the number 1 - 100 is
73
The sum of the number 1 - 100 is
74
The sum of the number 1 - 100 is
75
The sum of the number 1 - 100 is
76
The sum of the number 1 - 100 is
77
The sum of the number 1 - 100 is
78
The sum of the number 1 - 100 is
79
The sum of the number 1 - 100 is
80
The sum of the number 1 - 100 is
81
The sum of the number 1 - 100 is
82
The sum of the number 1 - 100 is
83
The sum of the number 1 - 100 is
84
The sum of the number 1 - 100 is
85
The sum of the number 1 - 100 is
86
The sum of the number 1 - 100 is
87
The sum of the number 1 - 100 is
88
The sum of the number 1 - 100 is
89
The sum of the number 1 - 100 is
90
The sum of the number 1 - 100 is
91
The sum of the number 1 - 100 is
92
The sum of the number 1 - 100 is
93
The sum of the number 1 - 100 is
94
The sum of the number 1 - 100 is
95
The sum of the number 1 - 100 is
96
The sum of the number 1 - 100 is
97
The sum of the number 1 - 100 is
98
The sum of the number 1 - 100 is
99
The sum of the number 1 - 100 is
100