Dremendo Tag Line

Input numbers and print its square in Python

input() - Question 3

In this question, we will see how to input 5 numbers in Python programming using the input() function and print the square of each numbers on separate lines. To know more about input() function click on the input() function lesson.

Q3) Write a program in Python to input 5 numbers and print the square of each numbers on separate lines.

Program

print('Enter 5 numbers')
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print('Square of {}={}'.format(a,a*a))
print('Square of {}={}'.format(b,b*b))
print('Square of {}={}'.format(c,c*c))
print('Square of {}={}'.format(d,d*d))
print('Square of {}={}'.format(e,e*e))

Output

Enter 5 numbers
2
3
4
5
6
Square of 2=4
Square of 3=9
Square of 4=16
Square of 5=25
Square of 6=36
video-poster