Write a program in C++ to display the cube of the lowest integer up to the number the user will enter. You may use any type of loop that suits to solve the problem.
#include <iostream>
#include <string>
using namespace std;
int main() {
int number;
cout<<"Enter number: ";
cin>>number;
for(int i=1;i<=number;i++){
cout<<i<<"^3 = "<<(i*i*i)<<"\n";
}
system("pause");
return 0;
}
Comments
Leave a comment