-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrays_addition.java
More file actions
40 lines (31 loc) · 960 Bytes
/
Arrays_addition.java
File metadata and controls
40 lines (31 loc) · 960 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
public class Arrays_addition {
public static void main(String[] args) {
// Store Array Grp 01
int[] num1 = new int[5];
int[] num2 = new int[5];
int[] num3 = new int[5];
int num =5;
for (int i=0; i<5; i++){
num1[i]=i;
}
for (int i=0; i<5; i++){
num2[i] =num;
++num;
}
System.out.println("Vaues of arry 'num 1 + num 2': ");
for (int i=0; i<5; i++){
System.err.print(num1[i]+ " ");
}
System.out.println("Vaues of arry 'num 1': ");
for (int i=0; i<5; i++){
System.err.print(num2[i]+ " ");
}
for(int i=0; i<5; i++){
num3[i] = num1[i] + num2[i];
}
System.out.println("Vaues of arry 'num 2': ");
for (int i=0; i<5; i++){
System.err.print(num3[i]+ " ");
}
}
}