Print the square and cube of a given number.

In this basic Python program, we will print the square and cube of a given number using the ** method.

Steps to solve the program

  1. Take a number as input.
  2. Print the square and cube using the ** (power) method.
  3. To print the square use  **2 and for the cube use **3.
  4. Print the output.

Program :

n = 9

print("Square of number :", n**2)

print("Cube of number :", n**3)

Output :

Square of number: 81
Cube of number: 729



Leave a Comment