Computer Science
Write a program to read a number n and print n2, n3 and n4.
Python
Python Funda
210 Likes
Answer
n = int(input("Enter n: "))
n2, n3, n4 = n ** 2, n ** 3, n ** 4
print("n =", n)
print("n^2 =", n2)
print("n^3 =", n3)
print("n^4 =", n4)
Output
Enter n: 2
n = 2
n^2 = 4
n^3 = 8
n^4 = 16
Answered By
108 Likes
Related Questions
Write a short program that asks for your height in centimetres and then converts your height to feet and inches. (1 foot = 12 inches, 1 inch = 2.54 cm).
Write a program to find area of a triangle.
Write Python program that accepts marks in 5 subjects and outputs average marks.
Write a program to compute simple interest and compound interest.