Please explain the loop further with the given example in tutorial | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Please explain the loop further with the given example in tutorial

28th May 2017, 9:16 AM
Vansh Wadhwa
Vansh Wadhwa - avatar
4 Answers
+ 5
huh
28th May 2017, 9:19 AM
jay
jay - avatar
+ 3
int main() { int i = 0; //declaring and initilize variable i (why i ? for short loop, i is often used. it is some convention among programmer.) while(i < 3) // set the condition if value i is less than 3, then the code below is executed : { cout<<i; // print out i i++; // increment i } return 0; } you can copy that to codeplayground. change the value of i like 1 or 2, or change the condition like i < 10 or i < 7. more practice better understanding.
28th May 2017, 2:32 PM
Setiawan Next
Setiawan Next - avatar
+ 2
while loop
28th May 2017, 1:02 PM
Vansh Wadhwa
Vansh Wadhwa - avatar
+ 1
there are many loops. which one?
28th May 2017, 9:54 AM
Setiawan Next
Setiawan Next - avatar