Given a number, check if it is perfect square or not.
Input : 2500 Output : Yes 2500 is a perfect square. 50 * 50 = 2500 Input : 2555 Output : No
- Take the square root of the number.
- Take floor/ceil/round of the square root which we got in step 1.
- Subtract value we got in step 2 from the square root.
- If the output of step 3 is 0 then the number is perfect square else not.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check if a number is perfect square without finding square root
- Check if a given number is a Perfect square using Binary Search
- Check whether the number can be made perfect square after adding 1
- Check whether the number can be made perfect square after adding K
- Find smallest perfect square number A such that N + A is also a perfect square number
- Smallest N digit number whose sum of square of digits is a Perfect Square
- Check perfect square using addition/subtraction
- Check if product of array containing prime numbers is a perfect square
- Largest number that is not a perfect square
- Perfect Square factors of a Number
- Find minimum number to be divided to make a number a perfect square
- Previous perfect square and cube number smaller than number N
- Number of times the largest perfect square number can be subtracted from N
- Find the Next perfect square greater than a given number
- Largest perfect square number in an Array
- Largest factor of a given number which is a perfect square
- Largest Divisor of a Number not divisible by a perfect square
- Largest N digit Octal number which is a Perfect square
- Least number to be added to or subtracted from N to make it a Perfect Square
- Probability of getting a perfect square when a random number is chosen in a given range
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t