Computer Science, asked by nevxrgxveup, 2 months ago

PART 2
Problem #2: [35 pts] Average of Five Odd Numbers
Write a Java program that asks the user to enter 5 odd integers. When the user enters an even number, the
program discards the entry and resumes reading until exactly 5 odd integers have been entered. In the end,
the program displays the average of all accepted entries.
Sample run:
Enter an odd integer: 5
Enter an odd integer: 4
4 is even. Entry discarded.
Enter an odd integer: 9
Enter an odd integer: 17
Enter an odd integer: 18
18 is even. Entry discarded.
Enter an odd integer: 5
Enter an odd integer: 3
The average of odd entries is 7.8

Answers

Answered by mrlegendrohit
0

Answer:

please mark me a Brilliant

Explanation:

Enter an odd integer: 5

Enter an odd integer: 4

4 is even. Entry discarded.

Enter an odd integer: 9

Enter an odd integer: 17

Enter an odd integer: 18

18 is even. Entry discarded.

Enter an odd integer: 5

Enter an odd integer: 3

The average of odd entries is 7.8

Similar questions