Write a Python Program to Read a number n and Compute n+nn+nnn – Programming, Pseudocode Example, C# Programming Example
Python 3

Write a Python Program to Read a number n and Compute n+nn+nnn

This is a Python Program to read a number n and compute n+nn+nnn.

The program takes a number n and computes n+nn+nnn.

Here is the source code of the Python Program to read a number n and compute n+nn+nnn. The program output is also shown below.

Program Explanation

1. User must first enter the value and store it in a variable n.
2. The integer is converted to string for concatenation of the value of n.
3. The string is then concatenated once and twice and stored in separate variables.
4. Later to find the total sum, the string is converted back to integer.
5. The total value of the expression is then printed.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.