Answer to Question #308835 in C++ for Chubby

Question #308835

Display the cube of the numbers up to a given intiger using any types of loop the suits to solve problem.



1
Expert's answer
2022-03-10T02:10:04-0500
#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;
}

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