forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray.java
More file actions
48 lines (35 loc) · 1.06 KB
/
Array.java
File metadata and controls
48 lines (35 loc) · 1.06 KB
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
package com;
//import java.util.Scanner;
public class Array {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int mul = 1;
int i[] = {1,2,3,4,5};
System.out.println("Elements of array are: ");
for (int j : i) {
System.out.println(j);
mul = mul * j;
}
System.out.println("Multiplication of all elements is = "+mul);
/*int i[][] = new int[2][2];
Scanner s = new Scanner(System.in);
System.out.println("Enter first element:");
i[0][0]=s.nextInt();
System.out.println("i[0][0] = "+i[0][0]);
System.out.println("Enter second element:");
i[0][1]=s.nextInt();
System.out.println("i[0][1] = "+i[0][1]);
System.out.println("Enter third element:");
i[1][0]=s.nextInt();
System.out.println("i[1][0] = "+i[1][0]);
System.out.println("Enter first element:");
i[1][1]=s.nextInt();
System.out.println("i[1][1] = "+i[1][1]);
System.out.println("Addition of all element:");
int sum = i[0][0]+i[0][1]+i[1][0]+i[1][1];
System.out.println("sum = "+sum);*/
}
}