Write a program that computes the value of n+nn+nnn+nnnn+... nn...n ntimes with a given number as the value of n. Ex :if n=3 , output = 3+33+333=369 and if n=1 output =1
a = int(input("Input an integer : "))
num1 = int( "%s" % a )
num2 = int( "%s%s" % (a,a) )
num3 = int( "%s%s%s" % (a,a,a) )
print (num1+num2+num3)
output:-
Input an integer : 12
122436
Post a Comment
If you have any doubts, Please let me know
Thanks!