Write a program
to
read in
and
print n^2,n^3,n^5 on python
Answers
Answered by
0
Program to print n^2,n^3,n^5 on python:
Output:
Enter any number: 3
3 ^2 = 9
3 ^3 = 27
3 ^5 = 243
Explanation:
Program:
n=int(input("Enter any number: ")) #input value from user
print(n,'^2','=',n*n) #calculate square and prints its value
print(n,'^3','=',n*n*n)#calculate cube and prints its value
print(n,'^5','=',n*n*n*n*n)# calculate power 5 and prints value
Description of the code:
- In the given program code, an integer variable "n" is defined, which takes value from the user end.
- In the next line, the print method is used, that calculate given value square, cube and power 5.
- In the calculation of square, its value is multiplied by 2 times, in the cube, it will multiply by 3 times, and in power 5 it will multiply 5 times, and print its value line by lines.
Learn more:
- Calculate value: https://brainly.in/question/10515324
Similar questions
Physics,
5 months ago
English,
5 months ago
Social Sciences,
11 months ago
Math,
11 months ago
CBSE BOARD XII,
1 year ago
English,
1 year ago