Topic 1202: Sorting

Source: Internet
Author: User

Topic 1202: Sorting

time limit:1 seconds memory limit:32 trillion special question: No

Title Description:

Sorts and outputs the n number of inputs.

Input:
The first line of input includes an integer n (1<=n<=100).
The next line consists of n integers.
Output:
There may be multiple sets of test data, and for each set of data, the sorted n integers are output, followed by a space after each number.
The result of each set of test data is one row.
Sample input:
4
1 4 3 2
Sample output:
1 2 3 4
1#include <stdio.h>2 3 intMainintargcConst Char*argv[])4 {5     intN,i =0, j =0;6     inta[ -] = {0};7 8      while(SCANF ("%d", &n)! =EOF)9     {Ten          for(i =0; I < n;i++) One         { Ascanf"%d",&a[i]); -         } -  the          for(i =0; I < n; i++) -         { -              for(j =0; J < N-1I J + +) -             { +                 if(A[j] > a[j +1]) -                 { +A[J] ^= A[j +1]; AA[j +1] ^=A[j]; atA[J] ^= A[j +1]; -                 } -             } -         } -  -          for(i =0; I < n; i++) in         { -printf"%d", A[i]); to         } +  -Putchar ('\ n'); the     } *  $     return 0;Panax Notoginseng}

Topic 1202: Sorting

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.