Lab13
public class ArrayOfScores
{
public static void main(String[] args)
{
int i,j,temp;
int[] score={1,4,8,5,6};
for (i=0;i<5;i++)
{
for (j=i+1;j<5;j++)
{
if (score[j]>score[i])
{
temp=score[i];
score[i]=score[j];
score[j]=temp;
}
}
System.out.println(score[i]);
}
}
}
{
public static void main(String[] args)
{
int i,j,temp;
int[] score={1,4,8,5,6};
for (i=0;i<5;i++)
{
for (j=i+1;j<5;j++)
{
if (score[j]>score[i])
{
temp=score[i];
score[i]=score[j];
score[j]=temp;
}
}
System.out.println(score[i]);
}
}
}
0 Comments:
張貼留言
<< Home