forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFor_check.java
More file actions
44 lines (35 loc) · 818 Bytes
/
For_check.java
File metadata and controls
44 lines (35 loc) · 818 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package loop;
import java.util.Scanner;
public class For_check {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Enter number for range: ");
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for(int i=2; i<=n; i=i+2){
System.out.println(i);
}
/*for(int i=n; i>=1; i--){
System.out.println(i);
}*/
/*for(int i=10; i>=0; i=i-2){
System.out.println(i);
}*/
/*Scanner s = new Scanner(System.in);
System.out.println("Enter size of array= ");
int k = s.nextInt();
int i[] = new int[k];
System.out.println("Even numbers till array size");
for (int j = 2; j < i.length; j=j+2) {
System.out.println(j);
}
*/
/*for (int j : i) {
System.out.println(j);
}*/
s.close();
}
}