Programming Examples
Python program to read a number in n and prints n2 n3 n4
WAP to read a number in n and prints n^2, n^3, n^4
Solution
n=int(input("Enter the value of n : "))
print("n^2 : ",n*n)
print("n^3 : ",n*n*n)
print("n^4 : ",n*n*n*n)
Output/ Explanation:
Enter the value of n : 5
n^2 :Â 25
n^3 :Â 125
n^4 :Â 625