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).
#include<iostream>
using namespace std;
int main()
{
double myNum=20.0;
while(myNum>0){
myNum-=0.5;
cout<<myNum<<" ";
myNum--;
}
}
Comments
Leave a comment