Question: ? ? * * * * * * Given two integers, the second larger than the first, this program: prints the even numbers between the

??******
Given two integers, the second larger than the first, this program:
prints the even numbers between the first and second number inclusive
prints the sum of those even numbers
prints the odd numbers between the first and second number inclusive
prints the sum of those odd numbers
**
Example:
Enter an integer: 10
Enter one larger than the first: 20
Even numbers: 101214161820
Sum of even numbers =90
Odd numbers: 11,13151719
Sum of odd numbers =75
**
This version uses WHILE loops.
**
@author
aversion
*/
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 ();
***help with this question using WHILE loops, also consider if the number input are the same. ***
 ??****** Given two integers, the second larger than the first, this

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!