REM Open the file day1a.dat
open "i",#1, "day1a.dat"
REM The open statement opens the file day1a.dat. "i" means input, i.e. that you want to
REM read the file, and #1 means channel 1.
REM
REM Read the number
input #1, num
REM The input command is the same as a normal input command, except for the #1
REM which indicates that you want to read from the file instead of from the keyboard.
REM Now calculate the square
square = num * num
REM This must be written to an output file, so first open it.
open "o", #2, "day1a.sol"
REM ... and now write to it.
print #2, square
REM Finally close the files
close #1
close #2
REM
REM For the competition, BASIC programs must finish with a SYSTEM command
SYSTEM