In every array a subscript is out of bounds when it is a negative b c 1 d 999

In every array a subscript is out of bounds when it

This preview shows page 5 - 11 out of 77 pages.

19.In every array, a subscript is out of bounds when it is _____. a.negativeb.0c.1d.999 20. You can access every element of an array using a _____. 5
Programming Logic and Design, 8e Programming Exercises 1.a. Design the logic for a program that allows a user to enter 12 numbers, then displays them in the reverse order of their entry. 6
Programming Logic and Design, 8e b. Modify the reverse-display program so that the user can enter up to 12 numbers until a sentinel value is entered.
Programming Logic and Design, 8e Solutions 6- Pseudocode: start Declarations num index num SIZE = 12 num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0,0,0 string CONTINUE = “Y” string moreNumbers getReady() while index < SIZE AND moreNumbers = CONTINUE getNumbers() endwhile finishUp() stop getReady() index = 0 output “Do you want to enter a number? (Y/N)” input moreNumbers return getNumbers() output “Enter a number for position ”, index input numbers[index] index = index + 1 8
Programming Logic and Design, 8e Solutions 6- output “Do you want to enter more numbers? (Y/N)” input moreNumbers return finishUp() output “The numbers in reverse order are: ” while index > 0 index = index – 1 output numbers[index] endwhile return 2.a. Design the logic for a program that allows a user to enter 12 numbers, then displays each number and its difference from the numeric average of the numbers entered. 9
Programming Logic and Design, 8e

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture