CUT AND PASTE THESE PROGRAMS INTO TRUE BASIC ! SQ8 program LET x = 3 LET y = 4 LET x = y LET y = 5 PRINT x END ! SQ9 program LET necessity$ = "mother of invention" LET one = 2 LET two$ = 2 LET three$ = "2 + 2" LET four$ = two$ + two$ PRINT necessity$, one, two$, three$ END ! SQ10 program PRINT "+ and – operators: "; 5 + 2 - 3 PRINT "* and / operators and parentheses: "; 2*(3+4)/6, 2*3+4/6 PRINT "^: "; 1 + 2^3 END ! SQ11 program ! Symbols to choose from: = > < >= <= <> IF 1 = 2 THEN PRINT "yes" ELSE PRINT "no" IF "truth" > "Beauty" THEN PRINT "yes" ELSE PRINT "no" END ! SQ12 and SQ13 program LET string$ = "Give me liberty or give me death" LET word$ = string$[9:15] PRINT word$ LET string$[20:19] = "maybe " PRINT string$ END ! SQ15 program DECLARE FUNCTION Right$ ! ********* Input values ************ LET name$ = "Horace" LET gender$ = "male" LET syllables = 2 ! ********* Main program ************ IF Right$(name$,1) = "y" THEN IF gender$ = "male" THEN PRINT "nickname" ELSE PRINT "full name" END IF ELSE IF syllables = 1 THEN PRINT "nickname" ELSE PRINT "full name" END IF END IF FUNCTION Right$(string$) = string$[Len(string$):Len(string$) END ! SQ16 program FOR n = 1 TO 100 PRINT n, n*n, Sqr(n) NEXT n END ! SQ17 program DO ! DO INPUT PROMPT "Enter nonnegative number: ": n ! LOOP IF n = 0 THEN EXIT DO PRINT Sqr(n) ! Sqr() is a built-in function for square-root LOOP UNTIL n = 0 END ! SQ18 program LET fake_mRNA$ = "GAAGCUCUU" LET original_fake_mRNA$ = fake_mRNA$ CALL Tail_message(fake_mRNA$) PRINT original_fake_mRNA$, fake_mRNA$ ! **** SUBROUTINES AND FUNCTIONS **** SUB Tail_message(mRNA$) LET length_of_mRNA = Len(mRNA$) LET mRNA$[length_of_mRNA:length_of_mRNA+10]= "AAAAAAAAAA" END SUB END ! SQ19 program DECLARE FUNCTION Tail_message$ LET fake_mRNA$ = "GAAGCUCUU" LET original_fake_mRNA$ = fake_mRNA$ LET tailed_message$ = Tail_message(fake_mRNA$) PRINT original_fake_mRNA$, fake_mRNA$, tailed_message$ ! **** SUBROUTINES AND FUNCTIONS **** FUNCTION Tail_message$(mRNA$) LET length_of_mRNA = Len(mRNA$) LET mRNA$[length_of_mRNA:length_of_mRNA+10]= "AAAAAAAAAA" LET Tail_message$ = mRNA$ END FUNCTION END