Write A Python Program To Print The Square Of All Numbers From 0 To 10

Hi Guys, welcome to my blog in this article you will learn about how to Write A Python Program To Print The Square Of All Numbers From 0 To 10

 

Title : 

Write A Python Program To Print The Square Of All Numbers From 0 To 10


Write A Python Program To Print The Square Of All Numbers From 0 To 10



 

Description : 

Hi guys, in this article you will learn The Python program that has the input range starting from 0 to 10 and your task is to print the squares of these numbers between 0-10 Let's take two variables: start and the limit. Initialize the start with 0 and limit with 10, using the print function just print a user friendly message


    

start = 0
limit = 10

print("Squares of Numbers between 0-10 is ...")


    


Use the while loop to iterate from 0 to 10. By using the below conditions and with in the while loop print the square of the number start by using double star (**) operator. Using the double star operator, raise it to power of 2 and print it. Once the printing is done, increment the start variable until it reaches 10.


    

while(start <= limit):
   print(start ** 2)
   start += 1


    




Complete Python Code : 


    

start = 0
limit = 10

print("Squares of Numbers between 0-10 is ...")
while(start <= limit):
   print(start ** 2)
   start += 1



    

 

 

Output : 


    

Squares of Numbers between 0-10 is ...
0
1
4
9
16
25
36
49
64
81
100



    

 

Output : 


    

Refer Above


    



Conclusion :

The above Python program uses the while loop to iterate from 0 to 10 and then uses the double star operator to raise it to power of 2. The program uses a double star operator to print the squares of numbers from 0 - 10 and keeps incrementing the start variable until it reaches 10. Comment it down below if you have any query is regarding the above Python program To support me please subscribe to my YouTube channel, so you don't miss out new content https://www.youtube.com/channel/UCUooZAqgfE4ngJ0oXsj3-MA

 

Post a Comment

0 Comments