1026:c Language Programming Tutorial (third Edition) After class exercise 7.4 array sorting

Source: Internet
Author: User

1026:c Language Programming Tutorial (third Edition) After class exercise 7.4 The topic describes an array of 9 elements that have already been sorted, and entering a number now requires that it be inserted into the array in the same order as it was originally ordered. Enter the first line, the original sequence. The second line, the number that needs to be inserted. Output sorted sequence sample input
1 7 8 17 23 24 59 62 10150
Sample output
178172324505962101
Hint Source #include<stdio.h> int main() {      int a[10],i,t;      for (i=0; i<10; i++) scanf ( "%d" ,&a[i]);      for (i=9; i!=0; i--) if (a[i]<a[i-1])t=a[i-1],a[i-1]=a[i],a[i]=t;      for (i=0;i<10;i++) printf ( "%d\n" ,a[i]);      return 0; }

1026:c Language Programming Tutorial (third Edition) After class exercise 7.4 array 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.