Question: This assignment is mainly to practice Iteration ( we review this week) and Selection programming structures. That is a FOR loop and IF ... THEN
This assignment is mainly to practice Iteration ( we review this week) and Selection programming structures. That is a FOR loop and IF ... THEN ... ELSEIF ... ELSE ... END IF structures.
Open a blank file (use Word or a text editor). Type your name and CS 3 in the beginning of the file.
Save the file as yourlastname-firstname-ProgIteration.docx or save the file as yourlastname-firstname-ProgIteration.txt. Preferably in CS 3 folder that you already created other assignments.
What is the output of the following code, what values of I and HowMuch will be displayed.
DIM i AS INTEGER
DIM HowMuch AS INTEGER
HowMuch = 0
FOR i = 1 TO 10
IF i < 5 THEN
HowMuch = HowMuch + 1
ELSEIF i = 5 THEN
HowMuch = HowMuch - 5
ELSE
HowMuch = HowMuch + 3
END IF
PRINT i, HowMuch
NEXT i
PRINT HowMuch
To receive credit for this assignment, submit yourlastname-firstname-ProgIteration.docx or yourlastname-firstname-ProgIteration.txt in this Assignment. Only ONE file, please.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
