Vic (for latest online version visit http://www1.idc.ac.il/vic/ where you can upload your program as a text file, step, run, pause, or Fetch & Execute through with the click of a button or two.)

Program 1: Adding two numbers

 

 

 

Program 2: Finding the maximum of two numbers

algorithm

program

0. read a number (into D)
1. store it somewhere (say in cell 90)
2. read a number (into D)
3. store it somewhere (say in cell 91)
4. subtract M[90] from D
5. if D>0 goto ___
6. load the contents of cell 90
7. write
8. stop
9. load the contents of cell 91
10 write
11. stop
00 800
01 490
02 800
03 491
04 290
05 709
06 390
07 801
08 000
09 391
10 801
11 000

 

 

 

 

 

 

Program 3: Sum up a series of numbers

algorithm

program
w/bug

0. read a number (into D)
1. If the number is 0, goto ____
2. add M[90] to D
3. store the result (D) in M[90]
4. goto 0
5. load M[90] into D
6. write
7. stop
00 800
01 605
02 190
03 290
04 500
05 390
06 801
07 000
using input values of 283, -2, 2, 2, 5 and 0 the output should be 290  

Assignment: Write a sumOfSeries.txt file that initializes cell 90 with 0, adds up the numbers typed into the input, when 0 is read in writes the sum to the output. Bring your file to class next week. Be sure to test your program if you get the VIC simulator working on your home machine or online at Vic.