Question: write a java program which will keep reading in numbers until it comes to a -1. Your program should then print the number which was

write a java program which will keep reading in numbers until it comes to a -1. Your program should then print the number which was just before the -1.

e.g:

Enter numbers: 30 15 4 -6 9 -1 The penultimate number was: 9

e.g:

Enter numbers: 5 100 -1 The penultimate number was: 100

write it using java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!