PART A: Write a program WhileLoops that uses while loops to perform the following steps: 1. Prompt the user to input two positive integers: firstNum and secondNum (firstNum must be smaller than...


Java


PART A: Write a program WhileLoops that uses while loops to perform the following steps:<br>1. Prompt the user to input two positive integers: firstNum and secondNum (firstNum must be smaller<br>than secondNum).<br>2. Output all the even numbers between firstNum and secondNum inclusive.<br>3. Output the sum of all the even numbers between firstNum and secondNum inclusive.<br>4. Output all the odd numbers between firstNum and secondNum inclusive.<br>5. Output the sum of all the odd numbers between firstNum and secondNum inclusive.<br>EXAMPLE OUTPUT:<br>Enter an integer:<br>3<br>Enter another integer larger than the first one:<br>10<br>Even numbers: 4 6 8 10<br>Sum of even numbers<br>= 28<br>Odd numbers: 3 5 7 9<br>Sum of odd numbers<br>= 24<br>

Extracted text: PART A: Write a program WhileLoops that uses while loops to perform the following steps: 1. Prompt the user to input two positive integers: firstNum and secondNum (firstNum must be smaller than secondNum). 2. Output all the even numbers between firstNum and secondNum inclusive. 3. Output the sum of all the even numbers between firstNum and secondNum inclusive. 4. Output all the odd numbers between firstNum and secondNum inclusive. 5. Output the sum of all the odd numbers between firstNum and secondNum inclusive. EXAMPLE OUTPUT: Enter an integer: 3 Enter another integer larger than the first one: 10 Even numbers: 4 6 8 10 Sum of even numbers = 28 Odd numbers: 3 5 7 9 Sum of odd numbers = 24

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here