Is there any way to represent any number as sum of 4 squares?
<p>Is there any way to represent any number as sum of 4 squares.</p>

<p>For example 29 can be represented as 5^2+2^2+0^2+0^2</p>

<p>I tried the following code but some numbers giving 5terms for example 23 as 4^2+2^2+1^2+1^2+1^2</p>

<p>the code i tried is :</p>

<pre><code> x=0;
 while(num!=0){
          x=(int)Math.floor(Math.sqrt(num));
         num=num-(x*x);        
}
</code></pre>
