Anonymous

How do I write a program to print the product of cubes of first 10 natural numbers?

1

1 Answers

Lia Tan Profile
Lia Tan answered

For this type of problem, I'd just use a "for" loop. So for instance, if you're using Matlab, it'll look like this:

p = 1;

for k = 1:10

      p = p*k^3;

end

disp(p)

You may not be using Matlab but other computer programs are pretty similar when it comes to "for" loops since it is a pretty basic command.

Answer Question

Anonymous