13th Jun 2020, 2:25 PM
Even Dead I Am The Hero.
Even Dead I Am The Hero. - avatar
3 Respuestas
+ 1
Hello Even Dead I Am The Hero. At first you need to enter a number for n. Let's say 5. Then you have a while loop. While i <= n. The loop runs until i gets larger than 5. i starts at 1 and sum at 0. 1 <= 5 sum += 1 //1 i += 1 //2 2 <= 5 sum += 2 //3 i += 1 //3 3 <= 5 sum += 3 //6 i += 1 //4 4 <= 5 sum += 4 //10 i += 1 //5 5 <= 5 sum += 5 //15 i += 1 //6 6 <= 5 is false, end while loop print 15.
13th Jun 2020, 2:41 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Denise Roberg thank you so much for this explanation.
13th Jun 2020, 5:52 PM
Even Dead I Am The Hero.
Even Dead I Am The Hero. - avatar
0
Even Dead I Am The Hero. Your welcome :)
13th Jun 2020, 6:41 PM
Denise Roßberg
Denise Roßberg - avatar