Question: Modify the code to print the numbers from 1 to 10 inclusive. Then print them on the same line separated by a space, followed by

  1. Modify the code to print the numbers from 1 to 10 inclusive.
  2. Then print them on the same line separated by a space, followed by a newline.
  3. Add code to compute and print out the sum.
  4. Now make it count backwards from 5 to 1 but without using the literal 1.

int count = 0;

while (count < 5)

{

System.out.println(count);

count++;

}


Step by Step Solution

3.39 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Code public class Main public ... 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!