-
Notifications
You must be signed in to change notification settings - Fork 0
/
breakandcontinueStatements.java
49 lines (41 loc) · 1.36 KB
/
breakandcontinueStatements.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
public class breakandcontinueStatements {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
// // // using Break
// // 1. Break in between
// for( int i = 1 ; i <= 5 ; i++ ){
// if( i == 3 ){
// break;
// }
// System.out.println(i);
// }
// System.out.println(" out of loop ");
// // 2. Keep Entering numbers till users enters a multiple of 10
// for(; true ;) {
// System.out.print(" Enter the number ");
// int n = sc.nextInt();
// if( n % 10 == 0 ){
// break ;
// }
// System.out.println(n);
// }
// // // using Continue
// // 1. Continue in between
// for( int i = 1 ; i <= 5 ; i++ ){
// if( i == 3 ){
// continue;
// }
// System.out.println(i);
// }
// // // 2. Dispaly all numbers entered by user except multiple of 10
// do{
// System.out.print("Enter the number ");
// int n = sc.nextInt();
// if( n % 10 == 0 ){
// continue;
// }
// System.out.println("number is " + n);
// }while(true);
}
}