Input the value of n and calculate n^2, n^3, n^4 in Python


Write a program in python to input the value of n and calculate n^2, n^3, n^4?

n=int(input("Input the value of n: "))
print("n^2  :", n*n)
print("n^3  :", n*n*n)
print("n^4  :", n*n*n*n)

Output:-

Input the value of n: 3

n^2  : 9
n^3  : 27
n^4  : 81


Post a Comment

0 Comments