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...
Works in the public domain are subject to copyright
Indicate whether the statement is true or false
Answer the following statements true (T) or false (F)
1. The modulus operator (%) performs division between two integers, but rather than returning the quotient, it returns the remainder. 2. Mathematical expressions involving multiple operators are always evaluated from left to right. 3. When you perform a math operation on two operands of the same data type, the result will always be of that data type. 4. C# does not allow operations that mix the decimal and double data types unless you use a cast operator to explicitly convert one of the operands.