loop inside the loop hlp

plz hlp me here masters!

#include <iostream.h>
void main()
{
int z,x,y;
{
for (x=1;x<=2;x++)
{
for (y=1;y<=5;y++)
{
z=x*y;
cout<<z<<",";
}
cout<<"\n";
}}}



it shows this functoin:
1,2,3,4,5,
2,4,6,8,10,

my question is how can i do function like this:
100,300,900,2700,8100,
24300,72900,218700,656100,1968300,
plz tell me how to do it T_T
No need for embedded for-loops

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
using namespace std;

int main() {
	int product = 100;
	int multiplier = 3;
	cout << product;
	for( int i = 0; i < 9; ++i ) {
		product *= multiplier;
		cout << ", " << product;
	}
	cout << endl;
	return 0;
}


Use code tags next time to embed c++ code in your post.
Last edited on
Topic archived. No new replies allowed.