To display the greatest number


Write a program in java assign 10 different number in a single Dimensional Array and display the greatest number of the elements.  

 

public class great

{

public static void  main (String arg[])

{

int i,max;

max=0;

int m[]={22,43,32,4,56,76,18,32,77};

for(i=0;i<=10;i++)

{

if(max<m[i])

max=m[i];

}

System.out.println(“the greatest of the array elements=”+max);

}}

Related Posts

Comments are closed.