Write a java program to find maximum of three numbers. - Pratik Ghelani

Pratik Ghelani

Breaking

Friday, January 25, 2019

Write a java program to find maximum of three numbers.

Program:-

public class p3b {
public static void main(String[] args)
{
int a[]=new int[3];
a[0]=20;
a[1]=40;
a[2]=60;
int size,max,i;
size=a.length;
max=a[0];
for(i=1;i<size;i++)
{
if(max<a[i])
{
max=a[i];
}
}
System.out.println("maximum is:"+max);
}

}

Output:-




No comments:

Post a Comment