Beruflich Dokumente
Kultur Dokumente
Looping Statements
• 2nd way : You can send message from Udemy (it can be private message or forum message)
Please do not hesitate to ask your questions to us. Be sure that we will do our best to help you as soon as possible.
SECTION CHALLENGE QUESTION #1 : Develop a program that prints the numbers like this :
1
32
456
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16
22 23 24 25 26 27 28
.
.
SECTION CHALLENGE QUESTION #2 : Develop a program that prints the numbers like this :
10 9 8 7
456
32
SECTION CHALLENGE QUESTION #3 : What will be the result of this program (try to find the output without compile&run process)
public class LoopExample {
public static void main(String[] args) {
int x = 0;
while (x < 50)
do {
System.out.print(x++ + " ");
x += 20 % 15;
} while (x < 10);
x++;
}
}
SECTION CHALLENGE QUESTION #4 : What will be the result of this program (try to find the output without compile&run process)
public class LoopExample {
public static void main(String[] args) {
int y = 3;
for (int x = 0; x < 11; x++) {
if (x > 7) {
System.out.println("1st Part");
break;
}
if (x >= 2) {
System.out.println("2nd Part");
continue;
}
if (x > 9) {
System.out.println("3rd Part");
continue;
}
y+=x;
}
System.out.println(y);
}
}
ANSWER OF QUESTION #1 :
public class Exercise {
public static void main(String args[]) {
int count = 1;
ANSWER OF QUESTION #2 :
public class Exercise {
public static void main(String args[]) {
ANSWER OF QUESTION #3 :
0 6 12 18 24 30 36 42 48
ANSWER OF QUESTION #4 :
2nd Part
2nd Part
2nd Part
2nd Part
2nd Part
2nd Part
1st Part
4
Have you visited AKINCI Training’s blog: live2develop.com?
Join us today! :)