You are here: Home / Topics / Python program that accepts an integer (n) and computes the value of n+nn+nnn

Python program that accepts an integer (n) and computes the value of n+nn+nnn

Filed under: Python on 2023-09-18 06:59:12

Code:

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)     

Output:

615  


About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.