Babbage problem: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1,059:
The smallest number whose square ends in 269696 is 25264
</pre>
 
=={{header|Scala}}==
<lang scala>//Babbage Problem
 
object babbage{
def main( args:Array[String] ){
var x:Int = 524 //Sqrt of 269696 = 519.something
while( (x*x) % 1000000 != 269696 ){
if( x%10 == 4 )
x = x+2
else
x = x+8
}
println("The smallest positive integer whose square ends in 269696 = " + x )
}
}
</lang>
 
=={{header|Sidef}}==
Anonymous user