package com.talent;
public class Dublicate_Element {
public static void main(String[] args) {
int A[]=new int[]{1,2,3,4,5,6,7,8,9}; //take element in array
int B[]=new int[A.length*2]; // here we double the size of array
for (int i = 0,k=0; i < A.length; i++,k++)
{
B[k]=A[i];
B[++k]=A[i];
}
for (int i = 0; i < B.length; i++)
{
System.out.println(B[i]);
}
}
}
OuTPuT->112233445566778899
OuTPuT->112233445566778899
No comments:
Post a Comment