![]() |
VOOZH | about |
Write a program to print the first 10 perfect squares. A perfect square is an integer which is the square of some other integer, or we can say that it is a second exponent of an integer.
Output format:
1 4 9 16 25 ....
Approach:
We know that the first 10 perfect squares will be square of 1, square of 2, square of 3... till square of 10. So, iterate from 1 to 10 and print squares of each number.
Step-by-step algorithm:
Below is the implementation of the above approach:
1 4 9 16 25 36 49 64 81 100
Time Complexity: O(1)
Auxiliary Space: O(1)