Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( The first four of these are from Review Exercise R 4 . 3 at the end of Chapter 4 of Java for Everyone )

(The first four of these are from Review Exercise R4.3 at the end of Chapter 4 of Java for Everyone). Using the kind of tracing tables discussed in Writing and Tracing Loops, provide tracing tables for these loops:
1
2
3
4
5
6
int i =0, j =10, n =0;
while (i < j){
i++;
j--;
n++;
}
1
2
3
4
5
6
int i =0, j =0, n =0;
while (i <10){
i++;
n = n + i + j;
j++;
}
1
2
3
4
5
6
int i =10, j =0, n =0;
while (i >0){
i--;
j++;
n = n + i - j;
}
1
2
3
4
5
6
int i =0, j =10, n =0;
while (i != j){
i = i +2;
j = j -2;
n++;
}
1
2
3
4
5
int i =3, j =4, n =0;
while (i !=0){
n += j;
i--;
}

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