-
-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathloops.java
More file actions
24 lines (23 loc) · 633 Bytes
/
loops.java
File metadata and controls
24 lines (23 loc) · 633 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class loops {
public static void main(String[] args) {
for (int i=1;i<=10;i++)//for loop
{
System.out.println(i);
}
System.out.println();
int j=1;
while(j<=10)//while loop
{
System.out.println(j);
j++;
}
System.out.println();
int k=1;
do { //do-while loop
System.out.println(k);
k++;
}
while (k<=10);
}
}