Trace Tables

It's only fair to share...Share on FacebookTweet about this on TwitterPin on PinterestShare on Google+Share on RedditEmail this to someone

A trace table shows the value of each variable at each step of an algorithm. The algorithm below calculates monthly simple interest on a principe P over a period of years T. It then calculates a monthly allowance which spend the result over a year.

1 Input P

2 Input R

3 Input T

4 Let I = (P * R * T)/100

5 Let A = P + I

6 Let M = A/(12 * T)

7 Print M

8 Stop

The variables are the principal P, the simple interest rate R and the eime period T. The trace table shows one column for each variable.

Line P R T I A M
1 500
2 500 6
3 500 6 4
4 500 6 4 120
5 500 6 4 120 620
6 500 6 4 120 620 51.67
7 500 6 4 120 620 51.67
8 500 6 4 120 620 51.67

Comments are closed.