how to make this , i have no idea about nested loop

when i enter an integer 5 , two pattern just like the following would print
pattern 1
Pyramid A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2

Pyramid B
5
4 4 4
3 3 3 3 3
2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1
for
1
12
123
1234
12345

int main()
{
int i , j , num ;
cout << "enter an integer (1-9):";
cin >> num
for (i=1, i<=num ; i++){
for (J=num;j>=1;j--){
if (j <= i)
cout <<j;
else
cout << " ";
}
}
return 0
}

but i don't know how to make through
1234
123
12
1
closed account (48T7M4Gy)
Modular arithmetic to the rescue, make use of the % function.
Topic archived. No new replies allowed.