Tuesday 3 September 2013

Update environment variables 2 - algorithm

1.  The problem is that the environment variables need to be calculated.
2.  The inputs of this algorithm are X, Y and R.
3.  The outputs of this algorithm are X and Y.
4.  The processing tasks are Y incremented by R, If Y > 100 then X decremented by 10 and If Y > 200 then X and Y equal 0.
5.  Pseudocode

Update environment variables 2
Prompt user for X, Y, R

Get X, Y, R

Y = Y + R
If Y > 100
X = X - 10
If Y > 200
X = 0
Y = 0

End

No comments:

Post a Comment