Write a program using nested for loops that will print the table below exactly as shown: 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 You MUST use nested for loops to accomplish this. You MUST store the value printed in a variable. You cannot just print the values as a String like “10 11 12 13 14 ….”
Write a program using nested for loops that will print the table below exactly as shown:
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
You MUST use nested for loops to accomplish this. You MUST store the value printed in a variable. You cannot just print the values as a String like “10 11 12 13 14 ….”
Questions
- What is the primary difference between how a while loop operates and how a do while loop operates?
- View the code below and indicate where each variable would have scope. (Circle all boxes for each variable in which that variable would be useable.
class DoLittle {
public static void main(String[] args) {
int number = 3;
double cost = 11.00;
while(number >= 0) {
int value = 7;
if(value > 5){
value = value + 2;
number = number - 1;
String message = “good job!”;
}
}
value = 9;
System.out.println(cost);
}
}
Variables In which blocks is each useable?
number main method while loop if block
cost main method while loop if block
value main method while loop if block
message main method while loop if block
in java
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images