If x=0;what is the value of while(x<5) x++; cout <<"x"; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

If x=0;what is the value of while(x<5) x++; cout <<"x";

Its a while____ which will run __time and will give output=?

10th Aug 2018, 4:26 PM
Parmeet Singh
Parmeet  Singh - avatar
10 Answers
+ 4
Aziz mobarek your answer is wrong. You will se that why wrong if you try this code True: output is 1-2-3-4-5
11th Aug 2018, 4:17 PM
veysel
+ 3
if your question like this👉 if(x=0) { while(x<5) { x++; cout<<x; } } then answer will be 1,2,3,4,5
11th Aug 2018, 4:14 PM
Muhammed Bilal C A
Muhammed Bilal C A - avatar
+ 2
the value of x incrementing before cout<<x; in while loop so the first number will 0+1=1 second will 1+1=2 third number will 2+1=3 fourth number will 3+1=4 here the while condition is 0 up-to 5 so the answer is 12345
11th Aug 2018, 4:54 PM
Muhammed Bilal C A
Muhammed Bilal C A - avatar
+ 1
while loop will run 5 times and will give a output of 4.
11th Aug 2018, 9:02 AM
Abhijit Talli
Abhijit Talli - avatar
+ 1
Its a while loop which will run 5 times and will give output = 4
11th Aug 2018, 9:35 AM
Aayush Jha
Aayush Jha - avatar
+ 1
x
11th Aug 2018, 11:40 AM
Ahmad Sultan
Ahmad Sultan - avatar
+ 1
01234
11th Aug 2018, 3:40 PM
Aziz Mobarak
Aziz Mobarak - avatar
+ 1
hola🍐
16th Aug 2018, 1:56 PM
cata García
+ 1
Ur right mohommd ji
19th Aug 2018, 3:20 AM
Simran Pothiwal
0
If x++ is before cout<<"x" ; then Output 1-2-3-4-5
11th Aug 2018, 10:26 AM
veysel