Display the cube of the numbers up to a given intiger using any types of loop the suits to solve problem.
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i=1; i<=n; i++) {
int cube = i*i*i;
cout << cube << endl;
}
return 0;
}
Comments
Leave a comment