Other Programs

! A.S.C.I.I.
DO
GET KEY num
PRINT chr$(num); num
LOOP until num=32 !repeats until space bar is pressed
END

! Bigger
DECLARE FUNCTION larger
PRINT "Welcome to the 'BIGGER' program"
INPUT prompt "First number: ":num1
INPUT prompt "Second number: ":num2
PRINT "the larger of the two numbers:";num1, num2
PRINT "is";larger(num1, num2)
END
FUNCTION larger(num1, num2)
LET larger=num1
IF num1 LET larger=num2
END IF
END FUNCTION

! Area of a Circle
DECLARE FUNCTION a
CLEAR
PRINT " The Area of a Circle"
PRINT
PRINT "This program lets you input the diameter of a"
PRINT "circle, and computes and displays its area."
PRINT
CALL inputdata(diameter)
LET area=a(diameter)
CALL printresults(diameter, area)
END
SUB inputdata(diameter)
INPUT prompt "Enter the diameter ": diameter
PRINT
END SUB
FUNCTION a(d)
LET r=d/2
LET a=pi*r^2
END FUNCTION
SUB printresults(diameter, area)
PRINT "Diameter....."; diameter
PRINT "Area........."; area
END SUB

! Colors
SET COLOR 1
PRINT "color 1"
SET COLOR 2
PRINT "color 2"
SET COLOR 3
PRINT "color 3"
SET COLOR 4
PRINT "color 4"
SET COLOR 5
PRINT "color 5"
SET COLOR 6
PRINT "color 6"
SET COLOR 7
PRINT "color 7"
SET COLOR 8
PRINT "color 8"
SET COLOR 9
PRINT "color 9"
SET COLOR 10
PRINT "color 10"
SET COLOR 11
PRINT "color 11"
SET COLOR 12
PRINT "color 12"
SET COLOR 13
PRINT "color 13"
SET COLOR 14
PRINT "color 14"
SET COLOR 15
PRINT "color 15"
SET COLOR 16
PRINT "color 16"
END

! Do-Loops
DO
INPUT prompt "First number ": num1
INPUT prompt "Second number ": num2
PRINT "Total ==>"; num1+num2
DO
INPUT prompt "Again (y/n) ": yn$
LET yn$=lcase$(yn$)
IF yn$<>"y" and yn$<>"n" then
PRINT "Invalid response"
END IF
LOOP until yn$="y" or yn$="n"
LOOP until yn$="n"
END

! Leap Years
INPUT prompt "What's the range of years?(start,end)":ipyr, ipyr2
PRINT "The Leap years are:"
FOR year=ipyr to ipyr2 step 4
PRINT year
NEXT year
END
Run

! Twinkle, Twinkle, Little Star
! Subprograms used:
! Refrain ...Displays the refrain of the poem
! Verse .....Displays a verse of the poem
CLEAR
PRINT "Twinkle, Twinkle, Little Star"
PRINT
CALL refrain ! Display the refrain
CALL verse ! Display the verse
CALL refrain ! Display the refrain
END
SUB refrain
! This subprogram displays the refrain from the poem
! Twinkle, Twinkle, Little Star
PRINT "Twinkle, twinkle, little star."
PRINT "How I wonder what you are."
END SUB
SUB verse
! This subprgram displays a verse of the poem
! Twinkle, Twinkle, Little Star
PRINT "Up above the world so high."
PRINT "Like a diamond in the sky."
END SUB