How can do "do while' in c++ of this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can do "do while' in c++ of this code.

Initial value of a is 0. It should print upto 5(a<=5). https://code.sololearn.com/cIMmud6NXEYf/?ref=app

26th Aug 2022, 10:43 AM
Pro Coder
Pro Coder - avatar
3 Answers
0
You are missing a semi colon in int a=0 ; And add print statement in loop cout << a;
26th Aug 2022, 11:00 AM
Jayakrishna 🇮🇳
+ 2
#include <iostream> using namespace std; int main() { int a = 0; do{ a++; cout<<a<<endl; } while (a<5); return 0; }
26th Aug 2022, 11:01 AM
Aman Kumar Sinha
Aman Kumar Sinha - avatar
0
Thanks, Worked
26th Aug 2022, 11:01 AM
Pro Coder
Pro Coder - avatar