Question: Second maximum Write a program that reads a sequence of integers until 0 and prints the second greatest value. For example, for the input 2
Second maximum
Write a program that reads a sequence of integers until 0 and prints the second greatest value. For example, for the input 2 3 5 5 0, the program prints 3 because 5 is the greatest value and 3 is the second greatest value. If the second maximum does not exist, the program prints No second maximum.
Example of input: 10 2 4 5 8 3 6 0
Corresponding output: 8
Example of input: 5 0
Corresponding output: No second maximum
Example of input: 7 7 0
Corresponding output: No second maximum
Please write in C.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
