The process of finding the largest value (i.e. the maximum of a group of values)
ID: 3761651 • Letter: T
Question
The process of finding the largest value (i.e. 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 sold the most units wins the contest. Conversely, sometimes we are interested in finding the smallest of a series of numbers. Write a program that accepts 10 integers and determines and prints the smallest and largest integer input by the user. Your program should use at least the following four variables: counter A counter to keep track of how many numbers have been entered. number The integer most recently input by the user. largest The largest number found so far. smallest The smallest number found so far.
Explanation / Answer
C code - https://drive.google.com/file/d/0B3lVit8k3iPqbmpoZ09UakxaeG8/view?usp=sharing
C++ code - https://drive.google.com/file/d/0B3lVit8k3iPqeEgxZC01NmFnTTg/view?usp=sharing
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.