Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
32

6.1. While: List of squares

pole55
pole55

"For a given integer N, print all the squares of positive integers where the square is less than or equal to N, in ascending order."

Example input
50

Example output
1 4 9 16 25 36 49

4 years ago
You are viewing a single comment. View All
1
pole55
pole55

@girianshiido
This code publishes only squares which are less than a given number. We have "if i**2 <= x" here for this. it is equal to your "while i*i <= x". just try it // Link to the task: https://repl.it/student/submissions/3764967

4 years ago