-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoops.java
More file actions
24 lines (24 loc) · 731 Bytes
/
Copy pathLoops.java
File metadata and controls
24 lines (24 loc) · 731 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
public class Loops {
public static void main(String[] args) {
//while loop
//execute codes while the condition is true
int count = 1;
while (count < 6){
System.out.println(count * 2);
count +=1;
}
System.out.println("\nfirst 20 numbers divisible by both 3 and 7 ");
//first 20 integers or numbers divisible by both 3 and 7
int loopCon =1;
int check = 0;
while(loopCon < 1000){
if ((loopCon %3 ==0)&&(loopCon%7 == 0)){
System.out.println(loopCon);
check ++;
if (check ==20){
break;
}
}loopCon ++;
}
}
}