90 likes | 181 Views
Explore output and errors in sample code, practice counting loops, input prompts, and ending programs with END statement.
E N D
What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END
What is the output? 0 -1 4 6 PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END
What are the 4 errors? ! doubler FOR A = 1 : 5 STEP 3 INPUT "What is X? ": X PRINT "2 * X = ",(2*X) NEXT
What are the 4 errors? ! doubler FOR A = 1 TO 5 STEP 3 INPUT PROMPT "What is X? ": X PRINT "2 * X = ",(2*X) NEXT A END 1) Range in counted loop must use TO 2) Must use INPUT PROMPT if providing text to user 3) Count Variable must be specified in NEXT statement 4) All programs must finish with END
What is the output? FOR X = 1 TO 2 FOR Y = 4 TO 5 PRINT X;"*";Y;"=";(X*Y) NEXT Y NEXT X END
What is the output? FOR X = 1 TO 2 FOR Y = 4 TO 5 PRINT X;"*";Y;"=";(X*Y) NEXT Y NEXT X END 1 * 4 = 4 1 * 5 = 5 2 * 4 = 8 2 * 5 = 10
What are the 3 errors? FOR Y = 1 TO 10 INCREMENT 1 INPUT J IF J IS 0 THEN PRINT "zero" ENDIF REM NEXT X NEXT Y END
What are the 3 errors? FOR Y = 1 TO 10 STEP 1 INPUT J IF J = 0 THEN PRINT "zero" END IF REM NEXT X NEXT Y END Amount added to counter variable is specified by keyword STEP Equality in IF condition is specified by equal sign ‘=‘ END IF command is two words