control
statement
in
JAVA
PRESENTED BY :
PRESENTED TO :
SUMIT RANSURMA - 24ADV3CST0169 DR REKHA RANAWAT
RAM MANDLOI - 24ADV3CST0136
ROHIT MANDLOI - 24ADV3CST0144
[Link] CST(IAC) - 2ND SEM (1ST - YEAR)
Topic For Today’s Session :-
public class Main {
public static void main(String[]
args) {
for (int i = 0; i < 5; i++) {
[Link](i); Output
} 0
}
}
1
2
3
4
public class {
public static void main(String[] args) {
int i = 1;
while (i <= 5) {
[Link]("Number: " + i);
i++;
} Output
} Number: 1
}
Number: 2
Number: 3
Number: 4
Number: 5
An example of a do-while loop looks like this
public class Main {
public static void main(String[] args) {
int i = 0;
do { Output
[Link](i);
i++;
} 0
}
while (i < 5);
1
} 2
3
4