How to check whether a number is perfect square or not using scanner class in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to check whether a number is perfect square or not using scanner class in java

I am a class 9 student,so plz help me

23rd Oct 2019, 3:10 AM
Ashutosh Panda
Ashutosh Panda - avatar
2 Answers
+ 1
You would need to use for loop to check: 0 * 0 1 * 1 2 * 2 3 * 3 ... If the result will ever equal to the given value, the value is a perfect square. Else if the result is greater than the given value, and if the result was never equal, the value is not perfect square.
23rd Oct 2019, 4:57 AM
Seb TheS
Seb TheS - avatar
+ 1
Thanks for helping,but I got better logic
5th Dec 2019, 4:54 PM
Ashutosh Panda
Ashutosh Panda - avatar