VIC PILOT Decimal Division
I teach a Computer Programming course to 8th graders at our school, Castillero Middle School, San Jose, California. We have seven Commodore PETs and a VIC-20. The language, of course, is BASIC.
But now we are also using PILOT … from COMPUTE!'s December 1982 issue. Our students are finding it quite interesting to write programs in PILOT that they had previously written in BASIC.
One of my students, Mike Jennings, was intrigued with the notion that PILOT was integer only. He wondered whether it would be possible to have PILOT do decimal division. The result was a program he wrote which does just that. The user is prompted for two numbers, and for the number of decimal places desired. One small problem is when the division works out evenly: that is, when the decimal terminates. In such cases an additional zero is printed.
I thought it was a pretty good effort for an 8th grader with only a semester of programming.
Lawrence E. Corina
70 T: 1 *AGAIN 2 T: 3 T : 2 NUMBERS? 4 C : #T = 0 5 A : #A 6 I : #A = 333 7 JY : *END 8 A : #B 9 T : CARRY OUT HOW MANY PLACES? 10 A : #L 12 *MAIN PART 14 I : #A <#B 16 TY:.; 18 JN : *A>B 20 CY : #A = #A*10 22 C : #C = #A/#B 24 C : #T = #T + 1 26 C : #D = #C*#B 28 C : #E = #A-#D 30 C : #A = #E*10 32 T : #C; 33 I : #T = #L 34 JY : *AGAIN 35 I : #C = 0 36 JN : 22 38 JY : *AGAIN 44 * A>B 46 C : #C = #A/#B 48 T : #C; 50 C : #D = #B*#C 52 C : #E = #A-#D 54 C : #A = #E*10 56 J : 35 60 *END