Try typing into the console above and hitting return. (The color change doesn't seem to work in the online version.)
Here is the code:
BASIC was the first programming language I started learning and using, back in the 80s from a book that came with a commodore 64. In fact I learned to type by programming BASIC. Typing commands like goto seem automatic, even today.
And, it even has graphics!
And here is a program to calculate prime numbers. One of the first programs I ever came up with was one like this.
Prime numbers never end in 2, 5 or 0, because we have a base 10 counting system. Once I tired writing a prime number generating program that used base 12, which has many more factors (2, 3, 4, 6) than 10 (2, 5) and could rule out primes based on the final digit rather than trying factors, but it was very inefficient to convert to base 12 and turned out to be slower.
No comments:
Post a Comment