samedi 9 décembre 2017

Can you print this pattern?

for input 3 the pattern should be

1
2*3
4*5*6
4*5*6
2*3
1

I tried using stack and counters to store the values and print it in the bottom loop, but the pattern started from 6

1
2*3
4*5*6
6*4*5
3*2
1

please help.

Aucun commentaire:

Enregistrer un commentaire