# Python printing numbers square

#### Table of Contents

- Introduction
- Printing numbers square using while loop
- Printing numbers square using for loop
- Printing even numbers square using while loop
- Conclusion

#### Introduction

Programs for printing square root of number, squaring only even numbers.

#### Printing numbers square using while loop

In while loop if variable index is less than equal to number then print statement executed square root of that number.

In python for squaring a number added two stars (**).

number = 5; index = 0; while index <= number: print(index**2) index+=1 #PYTHON OUTPUT 0 1 4 9 16 25

#### Printing numbers square using for loop

We use `range()`

function to loop using for loop and print square root.

number = 5 for index in range(0, number+1): print(index**2) #PYTHON OUTPUT 0 1 4 9 16 25

#### Printing even numbers square using while loop

Condition `(index%2)==0`

checks if the given number is even.

number = 8 index = 0 while index <= number: if (index%2)==0: print(index**2) index+=1 #PYTHON OUTPUT 0 4 16 36 64

#### Conclusion

You have reached at the end of our post on `Python printing numbers square`.we appreciate you for going through this post.

If you find anything difficult with our way of explanation please leave us a comment and if you have enjoyed reading our post then help

us grow by sharing this post link. We Thank You With All Our Heart.