0

Pls help. How to write a program to print this

1 2 4 8 3 6 12 9 Using c++

13th Apr 2020, 5:39 AM
Annabelle Llanto Navasero
Annabelle Llanto Navasero - avatar
4 odpowiedzi
+ 2
One doubt though, Isn't the third line supposed to be 3 6 12 24 Instead of 3 6 12 9
13th Apr 2020, 5:46 AM
Ipang
+ 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
5th May 2020, 9:31 AM
Annabelle Llanto Navasero
Annabelle Llanto Navasero - avatar
0
No its 3 6 12 9 😊
5th May 2020, 9:24 AM
Annabelle Llanto Navasero
Annabelle Llanto Navasero - avatar
0
I don't understand the pattern 😂
5th May 2020, 9:46 AM
Ipang