The loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The loops

what is the diffrent between these to code ? is there any diffrent in the result ? is there any diffrent between for loop and while loop in this condition ? int x = 5; while ( x > 2 ) { cout << x; endl; x++; } for (int x = 5 ; x > 2 ; x++ ) { cout << x; endl; }

21st May 2018, 10:18 AM
Mohammad Alshareef
Mohammad Alshareef - avatar
1 Answer
+ 1
the thing that i understood that in some condition while loop the same as for loop ,However the for loop summarize the time and effort through summarize the text and lines as you saw and THANKS YOU ๐Ÿ˜™๐Ÿ˜ƒ๐Ÿ˜
21st May 2018, 7:36 PM
Mohammad Alshareef
Mohammad Alshareef - avatar