Read a Number n and Compute n+nn+nnn in Python

Share on facebook
Share on twitter
Share on pinterest

In this Python program, we will have a look at how to read a number n & compute n+nn+nnn in python.

Python Program To Read a Number n and Compute n+nn+nnn in Python

n=int(input("Please enter a number n: "))
temp=str(n)
a1=temp+temp
a2=temp+temp+temp
comp=n+int(a1)+int(a2)
print("The value is:",comp) 

Output:

Pease enter a number n: 5
The value is: 615

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *