The process of finding the largest value (the maximum of a group of values) is used frequently in computer applications. For example, a program that determines the winner of a sales contest would input the number of units sold by each salesperson. The salesperson who sells the most units wins the contest. Write a pseudocode program and then a JavaScript program that inputs a series of 10 single-digit numbers as characters, determines the largest of the numbers and outputs HTML text that displays the largest num- ber. Your program should use three variables as follows:
counter:A counter to count to 10 (to keep track of how many numbers have been input, and
to determine when all 10 numbers have been processed)
number:The current digit input to the program
largest:The largest number found so far.
Top:
Determine the largest value in a group of numbers
First refinement:
Input number and check if it is greater than the largest
Print the largest number
Second refinement:
Input the first number directly into the variable largest
Increment counter to 2
While counter is less than or equal to 10
Input a new variable into the variable number
If number is greater than largest
replace largest with number
Increment counter
Print the value of largest (while condition false when counter is 11)
End program
```
1
2
3
4
5
6
17
18
19
You might also like to view...
To display a list of logical functions, you click the Logical button in the:
A) Function Library group on the Formulas tab. B) Function Library group on the Options tab. C) Tools group on the Formulas tab. D) Tools on the Options tab.
To determine a 10% growth rate over a previous month, you would take the previous month's sales and ________
A) divide by 110% B) divide by 10% C) multiply by 110% D) multiply by 10%
The VSTO ____ event executes as the Word document is closed.
A. ThisDocument_Startup B. Document_Shutdown C. ThisDocument_Shutdown D. Document_Startup
A pointer variable can be passed as a parameter to a function either by value or by ____.
A. retention B. reference C. approximation D. referral