1. Engineering
  2. Computer Science
  3. this assignment is mainly to practice iteration we review...

Question: this assignment is mainly to practice iteration we review...

Question details
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.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution