Fill in the blanks to print x's values from 1 to 5. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Fill in the blanks to print x's values from 1 to 5.

var x = 1; while(x=5){ document write(x +"<br />"); x=………+ 1; }

12th Apr 2017, 8:12 PM
Abdelrahim Ismail
Abdelrahim Ismail - avatar
9 Answers
+ 7
The loop won't run even once, as x is not equal to 5... I'd change it to while (x<=5) and the second last line is x=x+1
12th Apr 2017, 8:19 PM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
0
thank you
12th Apr 2017, 8:20 PM
Abdelrahim Ismail
Abdelrahim Ismail - avatar
0
int x = 1; while (x <= 5) { cout << x << endl; x ++ ; }
15th May 2020, 1:05 PM
Sara
Sara - avatar
0
Fill in the blank to output 5 raised to the 3rd power.
26th Dec 2020, 3:22 PM
Amran Ali Khan
Amran Ali Khan - avatar
0
Thanks you
24th Apr 2021, 3:12 PM
Mohammed Auwal Usman
Mohammed Auwal Usman - avatar
0
19th Jan 2022, 10:35 AM
Paul
0
Drag and drop to create a valid loop that outputs the numbers 5 to 1:
7th Sep 2022, 1:47 AM
M NISAM
M NISAM - avatar
- 1
var x = 1; while(x=5){ document write(x +"<br />"); x=………+ 1; } answer while 5 x
13th Jan 2022, 3:59 PM
James Obinna
- 1
Drag and drop to create a valid loop that outputs the numbers 5 to 1:
19th Jan 2022, 10:35 AM
Paul