Question: Given two integers, the second larger than the first, this program: * 1) prints the even numbers between the first and second number inclusive *

Given two integers, the second larger than the first, this program: * 1) prints the even numbers between the first and second number inclusive * 2) prints the sum of those even numbers * 3) prints the odd numbers between the first and second number inclusive * 4) prints the sum of those odd numbers * * Example: * Enter an integer: 10 * Enter one larger than the first: 20 * Even numbers: 10 12 14 16 18 20 * Sum of even numbers = 90 * Odd numbers: 11 13 15 17 19 * Sum of odd numbers = 75 *  * This version uses WHILE loops. * * @author * @version */

import java.util.Scanner; public class WhileLoops { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter an integer: "); int firstNum = in.nextInt(); System.out.print("Enter one larger than the first: "); int secondNum = in.nextInt();

// Complete the program } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the full code import javautilScanner public cla... View full answer

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 Programming Questions!