标题:大神帮看哪里格式需要改进?
取消只看楼主
yu497272290
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2013-11-2
结帖率:42.86%
已结贴  问题点数:10 回复次数:0 
大神帮看哪里格式需要改进?
#include<stdio.h>
#define SIZE 200

main()
{
    int a[SIZE];
    int count=1;
    int pass, hold, num, i;
    printf("Please input the number of integers:");
    scanf("%d", &num);
    printf("Please input the integers:");
   
    for(i=0; i<=num-1; i++){
        scanf("%d", &a[i]);
    }
   
    for(pass=0; pass<=num-1; pass++){
        for(i=0; i<=num-2; i++){
            if(a[i]%2!=0&&a[i+1]%2==0){
                hold=a[i];
                a[i]=a[i+1];
                a[i+1]=hold;
            }
        }
    }
    printf("The elements of the new array are:");
   
    for(i=0; i<=num-1; i++)
       printf("%2d",a[i]);
      
    return 0;
}

题目:排序,偶在前,奇在后
搜索更多相关主题的帖子: include number count hold 
2013-12-06 14:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-424786-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.815417 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved