Python program to calculate the sum when a number is appended to itself n number of times.
A number 'a' is given as the first input by the user. Another number 'n' is given as the second input. Initialize sum to 0. The number 'a' is appended 'n' times and the output of each iteration is added to sum(The value stored in sum is constantly updated). In the end, the sum value is printed as the output.
If '8' is given as the first input and '5' is given as the second input.
Such that a=8, n=5
Now, sum=8+88+888+8888+88888 = 98760.
Submitted by Tharunkumar C (tharun2k1)
Download packets of source code on Coders Packet