Or am I doing something stupid? I can’t for the life of me work out why the second output of this routine is zero. It should be 1.

Code: Select all

```
10 Let C=24
20 Let X=4
30 Let A=8
40 Let C= C/X
50 Let D= A/C
60 Let F= Int D
70 Let A= (D-F)*C
80 Print F
120 Let C= C/(x-1)
130 Let D=A/C
140 Let F= Int D
150 Print F
```

Line 150 should return “1”. If you input the results of part one manually (C=6, X=4, A=2) and run the program from line 120, it produces the correct result: line 150 returns “1”. If you print out C, X and A between line 80 and 120, they are 6,4 and 2. If you print A and C after line 130 they are 2 and 2, as they should be. If you print out A and C after line 140 they are 2 and 2. So why on earth is F zero?

Some numbers it works properly. For example if you change the starting conditions to C=24, X=4 and A=9, it works correctly. But starting with C=6, X=2 and A=3 gives the wrong output at 150 too.

Why is this? What am I missing?