By J.P. Lamoitier
Read Online or Download BASIC exercises for the Atari PDF
Best languages & tools books
Ebook by way of Lien, David A.
Ranging from the basis that knowing the principles of concurrent programming is vital to constructing disbursed computing platforms, this e-book first offers the basic theories of concurrent computing after which introduces the programming languages that aid improve dispensed computing platforms at a excessive point of abstraction.
Extra resources for BASIC exercises for the Atari
Furthermore, we may choose all divisors from the set of primes already found . Write a program that takes these two observations into account. 19: Output of Prime Numbers Solution: I n order to confine the search for possible divisors to the primes already found, we must be able to store or save the primes. This requires using an array, and the dimensions of that array will limit the maximum number of primes that can be investigated . To use the fact that the numbers EXERCISES USING INTEGERS are all of the form 6n ± 1, we should note that the numbers we are seeking are not divisible by 2 or 3; hence, we need only check for divisors from 5 upward.
It is often preferable to read a number, N, initially, that is the actual number of elements in the array. We can then provide a program that adapts itself to handle an array of any size, N, up to 100. 9 is much better from this point of view. argest-Element Program Comments: Looking in detail at this program we see that: Instruction 105 reads the number, N, of elements in the array. Line 200 holds the value 5 corresponding here to 5 elements. Line 210 holds the values of the 5 elements. This version of the program is limited by the instruction DIM A(l 00) to 100 elements.
J FLOWCHARTS This is not the best possible version, but it is easy to understand: Lines 110 to 130 read in the entire array. Lines 140 to 180 correspond to the search for the largest element in the array. , would normally hold the actual values of the 100 elements to be read into the array. Note that ATARI BASIC will not permit a subscripted variable in a READ statement, so an extra variable (y) is used in line 120. Criticism of this program: This program will not work unless the array contains exactly 100 elements.