Example 22: Four-Digit Perfect Square

Learn how to calculate a four-digit perfect square.

Problem

Write a program that finds four-digit perfect squares where the number represented by the first two digits and the number represented by the last two digits are also perfect squares.

Example

Input Output
Nil 1600
1681
2500
3600
4900
6400
8100

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Note: Try to generate perfect squares; however, the order does not matter as it depends on your logic.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.