0
Pls help. How to write a program to print this
1 2 4 8 3 6 12 9 Using c++
4 Antworten
+ 2
One doubt though,
Isn't the third line supposed to be
3 6 12 24
Instead of
3 6 12 9
+ 1
#include <iostream>
using namespace std;
int main()
{
int input;
cin>>input;
for (int i=1;i<=input;i++)
{
for(int j=1;j<=i;j++)
{
for(int k=1;k<=j;k++)
{
cout << (j*i)*k<< " ";
}
}
cout << endl;
}
return 0;
}
When u input 3
The results will be
1
2 4 8
3 6 12 9 18 27
0
No its 3 6 12 9
😊
0
I don't understand the pattern 😂