Computer Science, asked by ashishcharde01, 14 hours ago

Input Array : 2,4,8,5,12,15,6,10,7,30,25,43,46,45,21

Output Array : 2,4,8, 12, 6, 7, 43,46,21, 5,15,10,30,25,45​

Answers

Answered by ashishcharde786
4

Answer:

public static void main(String[] args) {

 

int a[]= {2,4,8,5,12,15,6,10,7,30,25,43,46,45,21};

System.out.println("------------------------");

System.out.println("input Array ");

for(int i= 0; i<a.length;i++)

{

 

 System.out.print(+a[i]+" ");

 

}

System.out.println("");

System.out.println("------------------------");

System.out.println("output array");

for(int i = 0;i<a.length;i++)

{

 

 

 if(a[i]%5!=0)

 

 {

 

  System.out.print(+a[i]+" ");

 

 }

   

}

for(int i = 0;i<a.length;i++)

{

 

 if (a[i]%5==0)

 {

 

  System.out.print(" "+a[i]+"");

 

 }

 

}

}

Explanation:

Similar questions