using System;
class BubbleSort
{
public static void Main()
{
int temp=0;
int[] score={9,3,4,6,2};
for(int i=0;i<=4;i++)
{
for(int j=0;j<=4-i-1;j++)
{
if(score[j]>score[j+1])
{
temp=score[j+1];
score[j+1]=score[j];
score[j]=temp;
}
}
}
for(int x=0;x<=4;x++)
{
Console.WriteLine(score[x]);
}
}
}
class BubbleSort
{
public static void Main()
{
int temp=0;
int[] score={9,3,4,6,2};
for(int i=0;i<=4;i++)
{
for(int j=0;j<=4-i-1;j++)
{
if(score[j]>score[j+1])
{
temp=score[j+1];
score[j+1]=score[j];
score[j]=temp;
}
}
}
for(int x=0;x<=4;x++)
{
Console.WriteLine(score[x]);
}
}
}
0 comments:
Post a Comment