Dremendo Tag Line

Print square and cube of a number in Python

print() - Question 12

In this question, we will see how to print the square and cube of a number in python programming using the print() function. To know more about print() function click on the print() function lesson.

Q12) Write a program in python to print the square and cube of a=8.

Program

a=8
print('Square of {}={}'.format(a,a*a))
print('Cube of {}={}'.format(a,a*a*a))

Output

Square of 8=64
Cube of 8=512
video-poster