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:
Enter one larger than the first:
Even numbers:
Sum of even numbers
Odd numbers:
Sum of odd numbers
This version uses WHILE loops.
@author
aversion
import java.util.Scanner;
public class WhileLoops
public static void mainString args
Scanner in new Scanner
System.in;
System.out.printEnter an integer: ;
int firstNum in nextInt ;
System.out.printEnter 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
