This program takes the /count variable and uses the add_numbers task to add /count to itself. Thus the result is always 2 x /count. It does this by calling the add_numbers task and providing the /count variable as the two input arguments. And the result of the addition is pushed into the /count_sum variable, as shown below:

add_numbers /count /count -> /count_sum

The tasks input arguments are /count /count and the output argument is /count_sum.

## Program

---

Add Numbers Program

---

prog_vars =

d/count 0

d/count_sum 0

prog_vars.

prog_start =

pclear

print "Add Numbers Program Start"

prog_start.

prog_loop =

-- main program loop

-- Add the /count to itself.

add_numbers /count /count -> /count_sum

-- Next number

inc /count

-- Check if we are done

any /count >= 10 -> exitprog

prog_loop.

add_numbers /a 0 /b 0 -> /total 0 =

add /a /b -> /total

print "Sum of /a and /b is /total"

add_numbers.

prog_stop =

print "Bye"

prog_stop.