Write a program to input an integer and then show the square, cube and Fourth square the integer.
Answers
Answered by
1
The below program is written in Python language.
Input:
num = int(input("Enter an integer: "))
print("The square of", num, "is: ", num**2)
print("The cube of", num, "is: ", num**3)
print("The fourth square of", num, "is: ", num**4)
Output:
Enter an integer: 3
The square of 3 is 9
The cube of 3 is 27
The fourth square of 3 is 81
Explanation of the program:
Line 1 asks the user to input an integer.
Line 2 prints the square of the integer.
Line 3 prints the cube of the integer.
Line 4 prints the fourth square of the integer.
Similar questions