Write a Python program that accepts an integer n and computes the value of n+nn+nnn

Write a Python program that accepts an integer n and computes the value of n+nn+nnn

Sample value of n is 7
Expected Result : 
861

a = int(input("Input an integer : "))
n1 = int( "%s" % a )
n2 = int( "%s%s" % (a,a) )
n3 = int( "%s%s%s" % (a,a,a) )
print (n1+n2+n3)

Result

Write a Python program that accepts an integer n and computes the value of n+nn+nnn

Write a Python program that accepts an integer n and computes the value of n+nn+nnn 

 

 

Leave a Comment