Answer:
#include <iostream>
using namespace std;
int main() {
float n;//declaring a float variable.
cout<<"Enter 0 to stop"<<endl;//printing the message.
cin>>n;//prompting n.
while(n!=0)//taking input until n is not 0.
{
cout<<"The cube is "<<n*n*n<<endl;//printing the cube.
cin>>n;
}
return 0;
}
Input:-
12
-8
3.93
-22.5
0
Output:-
Enter 0 to stop
The cube is 1728
The cube is -512
The cube is 60.6985
The cube is -11390.6
Step-by-step explanation:
I have declared a float variable n.I am prompting n from the user and letting the user know that he has to enter 0 to stop until the user shall type inputs.In the loop I am simultaneously printing the cubes of the numbers entered.