-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy.java
More file actions
43 lines (35 loc) · 893 Bytes
/
Copy pathcopy.java
File metadata and controls
43 lines (35 loc) · 893 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
import java.util.*;
public class copy {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
System.out.println("Enter the size of array");
int n=input.nextInt();
System.out.println("Enter the elements");
int [] arr=new int [n];
for(int i=0;i<n;i++)
{
arr[i]=input.nextInt();
}
System.out.println();
System.out.println("ENTERED ELEMENTS IN ARRAY 1 ARE ");
for(int i=0;i<n;i++)
{
System.out.print(arr[i]+" , ");
}
int []arr2=new int[n];
for(int i=0;i<n;i++)
{
arr2[i]=arr[i];
}
System.out.println();
System.out.println("ELEMENTS IN ARRAY 2 -----> ");
for(int i=0;i<n;i++)
{
System.out.print(arr2[i]+",");
}
System.out.println();
System.out.println();
System.out.println("Array Copied Sucessfully");
}
}