View the step-by-step solution to:

Hello dear, can you please help me in this assignment?

Hello dear, can you please help me in this assignment?

  1. What is the output of the following code snippet :

 int i = 1; 

 while (i != 8) 


 System.out.println("" + i); 

  i = i + 2; 


  1. Convert the following for loop into a while loop.


int sum = 0; 

for (int i = 8; i > 0; i--) 


  sum = sum + i 


  1. creat a while loop that computes the sum of all integers from 1 to 15. 

Top Answer

1)The output is : 1,2,5,7 because it displays the value of i beginning from i =1... View the full answer

Sign up to view the full answer

Other Answers

1.The output of the program is 1,2,5,7 i=8,sum =0;... View the full answer

1. 1,2,5,7 2. int i= 8 ,sum = 0 ; while (i> 0 ) {... View the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online