Example
Input
Enter the number 5
Output
The squared of the number is 25.0
Required to Know
Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like print(), and input(), Use of Math module and the use of function Pow(), and Use of Data types.
Steps
Take the number as an input from the user.
Import the math module for the usage of the pow function. Here the pow function will be used for finding the square of a number.
Print the squared value.
Program
# Import the math module
import math
# Take the number as an input from the user
number = int(input("Enter a number: "))
# Find the square of the number using the math.pow() function
squared_number = math.pow(number, 2)
# Print the squared number
print("The squared of the number is",squared_number)