Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Array Ascending Order

int[] sort = new int[5] { 66, 44, 21, 10, 7 };


int i,j,n;
for (i = 0; i < 5; i++)

for (i = 0; i < 5; i++ )


{
for(j=i+1; j<5; j++)
{
if(sort[i]>sort[j])
{
n = sort[i];
sort[i]=sort[j];
sort[j]=n;

}
}
}
Console.WriteLine("the number in ascending orderer are below");
for (i = 0; i < 5; i++ )
Console.WriteLine(sort[i]);

Console.ReadLine();

You might also like