KnowledgeBoat Logo
|

Informatics Practices

Write a Python program to calculate and display the square and cube of an inputted number.

Python Funda

4 Likes

Answer

num = int(input("Enter a number"))
s = num ** 2
c = num ** 3
print("Square of", num, "is:", s)
print("Cube of", num, "is:", c)

Output

Enter a number4
Square of 4 is: 16
Cube of 4 is: 64

Answered By

1 Like


Related Questions