Squares

Given a positive integer n, your task is to find all the numbers that are greater than or equal to 1 and their squares don’t exceed n. The program should print the squares of those numbers.
Input
Output
15
1 4 9
16
1 4 9 16
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue