import java.util.*;
class icse_specimen_1
{
public static void main(String[] args)
{
Scanner sc1 = new Scanner(System.in);
int a[] = new int[10];
System.out.println("Please enter array values");
for(int i=0;i<10;i++)
{
a[i] = sc1.nextInt();
}
int temp=0;
for(int j=0;j<10;j++)
{
for(int k=0;k<10;k++)
{
if(a[j]>a[k])
{
temp=a[k];
a[k]=a[j];
a[j]=temp;
}
}
}
System.out.println("Max Number "+a[0]);
System.out.println("Min Number "+a[9]);
}
}
No comments:
Post a Comment