Midterm tomorrow, please check my code here. I am using quizzes to study, so check my Q and A.
Q:Write a WHILE loop to print out a count from 0 to 100 by increments of two with single number number on each line. The first line should output 0, then 2 and so on until 100 is output. You should declare any variables necessary, but you do not need to place the code in a method or class. The code will receive 2 points for the correct loop type, 2 points for the correct starting position, 2 points for the correct ending position, 2 points for proper incrementation, and 2 points for the proper output statement.
A:
int x=0;
While(x<=100){
x=x+2;
System.out.println(x);
}
Q:Write a FOR loop to print out a countdown from 100 to 0 with a single number on each line. You should declare any variables necessary, but you do not need to place the code in a method or class. The code will receive 2 points for the correct loop type, 2 points for the correct starting position, 2 points for the correct ending position, 2 points for proper decrementation, and 2 points for the proper output statement.
A:
for(int x=100; x>=0; x=x-1)
System.out.println(x);
thanky. (cake, right? gotta start somewhere.)
Q:Write a WHILE loop to print out a count from 0 to 100 by increments of two with single number number on each line. The first line should output 0, then 2 and so on until 100 is output. You should declare any variables necessary, but you do not need to place the code in a method or class. The code will receive 2 points for the correct loop type, 2 points for the correct starting position, 2 points for the correct ending position, 2 points for proper incrementation, and 2 points for the proper output statement.
A:
int x=0;
While(x<=100){
x=x+2;
System.out.println(x);
}
Q:Write a FOR loop to print out a countdown from 100 to 0 with a single number on each line. You should declare any variables necessary, but you do not need to place the code in a method or class. The code will receive 2 points for the correct loop type, 2 points for the correct starting position, 2 points for the correct ending position, 2 points for proper decrementation, and 2 points for the proper output statement.
A:
for(int x=100; x>=0; x=x-1)
System.out.println(x);
thanky. (cake, right? gotta start somewhere.)