Showing posts with the label ArrayShow all

9) Write a Java program that finds largest integer and smallest integer from 10 given array numbers , program also display 5 elements per line.

Initialize an array of size 10 and find the largest integer and smallest integer in the array. Also to display the array elements 5 per line then display in the new line the largest and smallest integer. class array8 { public static void main(String as[]) { int arr[]={10,5,25,3,-4,100,1000,-10,77,38}; System.out.pri…

Read more

3) Write a Java program that finds Cube of Array Numbers.

class arrayobjectcube { void cube(int[] M) { for(int i=0;i<M.length;i++) System.out.println(M[i]*M[i]*M[i]); } public static void main(String  as[]) { System.out.println("array program"); int A[]={10,45,88,20,67}; arrayobjectcube ob=new arrayobjectcube(); ob.cube(A); } } Output- array program 1000 91125 6…

Read more