First Perfect Square

Find the Value

Write a program to find and print the first perfect square (i*i) whose last two digits are both odd.
--Very important
Make sure to check that the answer you get is indeed a perfect square.--

Any idea how to tackle this problem?
If i is a positive integer, i*i is a perfect square.
Squares of numbers greater than 3 have at least two digits. 3*3 == 9, 4*4 == 16

We can generate an ascending sequence of perfect squares with: 4*4, 5*5, 6*6, 7*7 ....
There is no need to check that these numbers are perfect squares; we know that these are perfect squares.

A positive integer is odd if it leaves a remainder of one when divided by two. n is odd if n%2 == 1.
The last digit of an odd integer is odd; the last digit of an even integer is even.

When we divide a positive integer by 10, the result is the number with the last digit removed. 12345/10 == 1234

Now, what would the value of (12345/10)%2 tell us?
Topic archived. No new replies allowed.