Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Copy an array elments into another array
import java.lang.*; class Rextester { public static void main(String args[]) { int arr1[] = new int[10]; int arr2[] = new int[10]; int i; for(i=0;i<10;i++) { int a=i+1; arr1[i] = a; } System.out.println("Elements of Arrays are : "); for(i=0;i<20;i++) { if(i<10) { if(i==0){ System.out.println("Array 1 : "); } System.out.print(arr1[i]+" "); } else { if(i==10){ System.out.println("\nArray 2 : "); } System.out.print(arr2[i-10]+" "); } } System.out.println("\nAfter Copy : "); for(i=0;i<20;i++) { if(i<10) { arr2[i]=arr1[i]; } else { if(i==10){ System.out.println("Array2 : "); } System.out.print(arr2[i-10]+" "); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
// Java Coding Challenge - 08: Reversing a Number using StringBuilder
Alllocate and release memory
Word pattern
Display Page
dfkbzhfvjahfjh
Add Index of max number in an array
Strings Ops
Minimum Vertices to Traverse Directed Graph
piglatin
InnerClass vs. Anonymous vs. Lambda...
Please log in to post a comment.