Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 WSWhile Loop Loops-Chapter Trace the following loops with columns for each variable output. Write compile error, runtime error or infinite loop whe appropriate. Name:Autato

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
4 WSWhile Loop Loops-Chapter Trace the following loops with columns for each variable output. Write "compile error", "runtime error" or "infinite loop" whe appropriate. Name:Autato show the variable values output while (num -5 66 dum 19) break; num++; System.out.println (num) i Loops-Chapter 4- S- Intra-Age1r Nested Loops Name : Show the output produced by the following segments of code. Assume that all variables are declared as int. 1. for (int k 0: k -4; d--) System.out.println(d+ " "+ e)i 3. x = 0; while (x = 1 ; j-= 2) System.out.printin (j); 5. for (i = 0 ; i 0; value--) |-systen.ou t_printintvalue); for (int value-li value> 20; value+-4) System.out.println (value) i For exercises 7 to 10, write code segments that will perform the specified action. EXAMPLE: Read and print values entered by a user until a particular sentinel value is encountered. Do not print the sentinel value. Assume the sentinel value is stored in a constant called SENTINEL. System.out.print ("Enter a value:") int value-. Integer.parseInt(num); while (value!-SENTINEL) System.out.println (value) ; System.out.print ("Enter another value:") value Integer. Parse int (num); 7. Verify that the user enters a positive value. (use a while loop) 8. Verify that the user enters an even value (use a do loop) 9. Read values from the user, quitting when a sentinel value of 0 is entered. Compute and print the product of all values entered (excluding the sentinel value). 10. Print the odd numbers between 1 and 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what is the theorem to finding an euler path

Answered: 1 week ago