Write a program that repeatedly asks the user to enter integer numbers (validation is not necessary). The program should continue to read numbers from the user until they enter a negative number (e.g., 3, 7, 3, 1, 6, 4, -1). Once the user enters a negative number, the program should stop repeating the prompt and print out the second largest number that the user has entered. You can assume the user will enter at least two non-negative (non-zero) numbers. Note: you may not use lists or other summary functions (max, min, etc.) for this problem. You should only need input/variables/looping/branching structures. Example: Enter positive integers: 3, 7, 3, 1, 6, 4, -1 The second largest number is: 6
Write a
Example:
Enter positive integers: 3, 7, 3, 1, 6, 4, -1 The second largest number is: 6
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images