vendredi 8 mai 2020

Row pattern Sum of digits

How to print the following pattern? If row and column are given. For example

x=5
y=6

starting from x and the next row is the sum value of the previous row.

55555
5+5+5+5+5=25

then the next row must be

25252

output:
55555
25252
16161
15151
13131
99999

Can anyone help me to write a program to solve this question?

Aucun commentaire:

Enregistrer un commentaire