Answer to Question #262295 in C++ for Vava

Question #262295

Convert the following FOR statement to WHILE statement: (5 MARKS)



#include <iostream>



using namespace std; #include <iostream>



using namespace std;



int main()



{



for (int counter = 1; counter <= 10; counter++)



cout << “Counter is: ” << counter << endl;



return 0;



}

1
Expert's answer
2021-11-07T01:43:11-0400
#include <iostream>
using namespace std; 


int main()


{
	int counter = 1;
	while(counter <= 10){
		cout << "Counter is: " << counter << endl;
		counter++;
	}
	cin>>counter;
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS