what perfect square number should be substracted from x so that resultant is perfect square number if solution doest not exist just tell not possible?
note here x is also perfect square number
example x=25
25-9=16(perfect square number)
here ans=9
x=100
100-36=64(perfect square number)
here ans=36
x=100
100-64=36 whis perfect square number
here ans=64
when x=4 ,6,3 and so on then no such answer will be exist
It's a bit unclear what you're asking about, but here are a few related tidbits.
You should read about Pythagorean triples. There are integers $(a,b,c)$ that satisfy
$$a^2 + b^2 = c^2$$
In this case $c^2$ is your $x$ and either $b^2$ or $a^2$ are possible values for what you subtract from your $x$.
You may also be interested in Fermat's theorem on sums of two squares, which answers the question of when a prime number can be written as a sum of two squares.
Given any integer, you can tell whether it can be written as the sum of two squares if you find its prime factorization. If all of the primes that are one less than multiples of four have even exponents in the prime factorization of your number, then it can be written as the sum of two squares. Otherwise, it cannot. You should first read Fermat's theorem on writing primes as sums of two squares if you want to understand this more general result.
This is related to your original question because if $x$ can be written as the sum of two squares, then you know at least two possibilities for "perfect squares that can be subtracted from $x$ to get another perfect square" ...