RosettaCodeData/Task/Babbage-problem/Commodore-BASIC/babbage-problem.basic

13 lines
457 B
Plaintext

10 rem This code is an implementation of Babbage Problem
20 num = 100 : rem We can safely start at 100
30 s = num*num
40 r = s - int(s/1000000)*1000000 : rem remainder when divided by 1,000,000
50 if r = 269696 then goto 100 : rem compare with 269,696
60 print "n="num"sq="s"rem="r
70 num = num+1
80 goto 30
90 rem Print out the result
100 print:print "The smallest number whose square ends in 269696 is:"
110 print num;"....";num;"squared = ";s
120 end