Answer to Question #255869 in C++ for Urooj

Question #255869

Write a program the declares and initalises the variable myNum to the value 20.


Miss question was the ofference bene and


Now using a while loop decrease the value of myNum by 0.5 and continue to print its value as long as it remains positive (e.g. above zero).


1
Expert's answer
2021-10-24T13:53:39-0400
#include<iostream>

using namespace std;

int main()

{

	double myNum=20.0;

	while(myNum>0){

		myNum-=0.5;

		cout<<myNum<<" ";

		myNum--;

	}

}

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