C Language Code programming questions Summary: ascending, odd in front, even in the rear

Source: Internet
Author: User

ascending, Odd in front, even in the rear

Your own code:

1 /*2 March 14, 2017 12:52:393 functions: ascending, Odd in front, even in the rear4 */5#include"stdio.h"6 intMain ()7 {8     intj =0, k =0;9     inta[Ten];Ten     intb[Ten]; one     intc[Ten]; a     int*PA =a; -  -printf"please input number: \ n"); the      for(inti =0; I <Ten; i++) -     { -printf"please input%dth number:", i+1); -scanf"%d",&a[i]); +         if(a[i]%2==0) -b[j++] =a[i]; +         Else  ac[k++] =a[i]; at  -     } -  -     int*PB =b; -     int*PC =c; -  in      for(intp =0; P < j; p++) -          for(intP1 = p; P1 < j; P1++)//int p1 = 1 cannot be defined here; to             if(b[p] >=b[p1]) +b[p1] =b[p]; -  the      for(intQ =0; Q < k; q++) *          for(intQ1 = q; Q1 < k; q1++) $             if(c[q] >=c[q1])Panax Notoginsengc[q1] =c[q]; -  the      while(j)//You cannot jump out of a loop with a while (*PC) statement here +     { a*PA = *pc; thepa++; +Pc++; -j--; $     } $      while(k) -     { -*PA = *pb; thepa++; -pb++;Wuyik--; the     } -      for(i =0; I <Ten; i++) wuprintf"%d", a[i]); -  about     return 0; $ } - /* - summary: - results shown in vc++6.0:: a —————————————————————————— + please input Number: the please input 1th number:1 - please input 2th number:2 $ please input 3th number:3 the please Input 4th Number:4 the please Input 5th Number:5 the please Input 6th Number:6 the please input 7th Number:7 - please input 8th Number:8 in please input 9th Number:9 the please input 10th number:10 the 1 3 5 7 9 2 4 6 8 about  the —————————————————————————— the  the */

C Language Code programming questions Summary: ascending, odd in front, even in the rear

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.