public class ex417a{public static void main(String[] args){int i, sum = 0;i = 1;while (i {sum += i;i++;}System.out.println("Sum of 1 through 10 = " + sum);}4-17b. Update 4-17a...

1 answer below »

public class ex417a
{

public static void main(String[] args)

{

int i, sum = 0;

i = 1;

while (i <=>

{

sum += i;

i++;

}

System.out.println("Sum of 1 through 10 = " + sum);

}
4-17b. Update 4-17a (which is attached) that summed the numbers 1

through 10 to get 55 (1 + 2 + 3 + ..... + 9 + 10 = 55) in a while loop.

Now let the user tell what number to start counting at, what number to

stop counting at, and what amount to go up each number. For example, if

the user wants to start at 7, go up to 19, by 4s, you will add 7 + 11 +

15 + 19 = 52 in a loop. Declare three variables (for starting number,

ending number, and amount to count by) and your Scanner object and then

prompt and input the three numbers from the user. Then modify the while

loop into

a for loop

with

the three parts for the start, end, and update amount, and the final

print. Save as ex417b.java, run with starting at 7, going up to 19, by

4s, save the output console as ex417b.txt, attach the ex417b.java and

ex417b.tx, and submit them.
Answered Same DayOct 08, 2022

Answer To: public class ex417a{public static void main(String[] args){int i, sum = 0;i = 1;while (i...

Vaibhav answered on Oct 09 2022
56 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here