Java Program to create a large array and copy its values equally to two small arrays and display the second array only
PROGRAM:
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(newInputStreamReader(System.in));
int[] l=new int[20];
for(int i=0;i<l.length;i++)
{String s=br.readLine();
l[i]=Integer.parseInt(s);
}
int[] s1=new int[10];
int[] s2=new int[10];
for(int i=0;i<10;i++)
{
s1[i]=l[i];
}
for(int i=10;i<20;i++)
{
s2[i-10]=l[i];
}
for(int i=0;i<10;i++)
{
System.out.println(s2[i]);
}
}}
INPUT:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
OUTPUT:
11
12
13
14
15
16
17
18
19
20
OUTPUT:
Comments
Post a Comment