power(a, n) { if (n == 0) { return 1; } else if (n < 0) { //-n is allowed return power(1/a, -n); } else if (round(n/2) == n/2) { return power(a*a, n/2); //even n } else { return a*power(a, n-1); //odd n } } plusSquare(){ var a,i,s,sum; read a; i = 1; sum = 0; println a," kez kareleri topla" ; while (i <= a){ s=power(i,2); print s," "; sum = sum + s; i = i+1; } println " "; println "Kareler Toplamı = ",sum; }