Code for sorting the numbers of C # N

Source: Internet
Author: User

CopyCodeThe Code is as follows: using system;

Namespace n count sorting
{

Class class1
{

Static void main (string [] ARGs)
{Console. writeline ("Enter the order of the numbers you want: \ n ");
Int N; // receives the order of several numbers.
N = int. parse (console. Readline ());
Int [] A = new int [N];
Console. writeline ("Enter the number you want to sort in sequence (Press enter to end the number): \ n ");
For (INT I = 0; I <n; I ++) // receives the number of orders you want
A [I] = int. parse (console. Readline ());
For (INT I = 0; I <n; I ++) // sort
{
For (Int J = I + 1; j <n; j ++)
{
Int temp;
If (A [I]> A [J])
{
Temp = A [J];
A [J] = A [I];
A [I] = temp;
}
}
}
Console. writeline ("the sorting result is \ n ");
For (INT I = 0; I <n; I ++)
Console. Write ("" + A [I]);

System. Threading. thread. Sleep (10000 );
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.