RosettaCodeData/Task/Babbage-problem/BBC-BASIC/babbage-problem-2.basic

26 lines
569 B
Plaintext

REM Lines that begin 'REM' are explanatory remarks addressed to the human reader.
REM The machine will ignore them.
LET n = 269696
REPEAT
LET n = n + 1000000
REM Find the next number that ends in 269,696.
REM The function SQR finds the square root.
LET root = SQR n
REM The function INT truncates a real number to an integer.
UNTIL root = INT root
REM If the square root is equal to its integer truncation, then it is an integer: so we have found our answer.
PRINT "The smallest number whose square ends in 269696 is" root
PRINT "Its square is" n