- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Program to Input a Number n and Compute n+nn+nnn
When it is required to take a number and compute a specific pattern, the value of n is taken from the user. Next, two variables are assigned this specific pattern and their sum is calculated.
Below is a demonstration of the same −
my_input = int(input("Enter a value for n...")) temp_val = str(my_input) t_1=temp_val+temp_val t_2=temp_val+temp_val+temp_val my_result = my_input+int(t_1)+int(t_2) print("The computed value is : ") print(my_result)
Enter a value for n...4 The computed value is : 492
An input from the user is taken.
It is converted into a string and assigned to a variable.
The value of ‘n*n’ and the value of ‘n*n*n’ is calculated.
Their sum is determined.
This sum is assigned to a variable.
This is displayed as the output.
- Golang Program to Read a Number (n) and Compute (n+nn+nnn)
- Program to compute Log n in C
- Write a program in Python to compute autocorrelation between series and number of lags
- Python program to compute a Polynomial Equation
- Python Program to Read a Number n And Print the Series "1+2+…..+n= "
- C++ Program to compute division upto n decimal places
- Python Program to Read a Number n and Print the Natural Numbers Summation Pattern
- Python Pandas - Compute slice locations for input labels
- Python program to check a number n is weird or not
- Python Program for n-th Fibonacci number
- N-th Fibonacci number in Python Program
- Python Pandas - Compute the slice indexer for input labels
- Write a program in Python to count the number of digits in a given number N
- Java program to compute Remainder and Quotient
- C Program to Compute Quotient and Remainder?