我们将编写一个程序,用Python计算以下系列。检查我们要编写的程序的示例输入和输出。Input:
34
3 + 33 + 333 + 3333
Output:
3702
Input:
5 5 5 + 55 + 555 + 5555 + 55555
Output:
61725
因此,我们将有两个数字,并且我们必须计算如上 生成的序列之和。请按照以下步骤实现输出。
算法1. Initialize the number let's say n and m.
2. Initialize a variable with the value n let's say change.
3. Intialize a variable s to zero.
4. Write a loop which iterates m times.
4.1. Add change to the s.
4.2. Update the value of change to get next number in the series.
5. Print the sum at the end