Java Program for Maximum Number

This java program will give you the largest number from a given set of numbers.

class Max
{
public static void main(String arg[])
{
int n=arg.length;
int i,a[]=new int[n];
int max;
for(i=0;i {
a[i]=Integer.parseInt(arg[i]);
}
max=a[0];
for(i=0;i {
if(a[i]>max)
{
max=a[i];
}
}
System.out.println(“maximum value is:”+max);
}
}

Simply copy paste the program into the editor.

Add Comment