I need to print this table
2
0
4 2
3 3
6 4 2
6 6 6
8 6 4 2
9 9 9 9
I have written this code for the following result
#include <iostream>
using namespace std;
int main(){
const int N = 9;
for(int i = 0; i <= N; i += 3){
for (int j = 0; j <= i; j +=3) {
cout << i << " ";
}
cout << endl;
}
cout << "\n";
for(int i = 2; i <= N; i += 2){
for (int j = i; j > 0; j -= 2) {
cout << j << " ";
}
cout << endl;
}
return 0;
}
My Result:
0
3 3
6 6 6
9 9 9 9
2
4 2
6 4 2
8 6 4 2
Required Result:
2
0
4 2
3 3
6 4 2
6 6 6
8 6 4 2
9 9 9 9