问答详情
源自:6-12 综合练习

这段程序有错吗,为啥运行显示没有错误,就是运行不出来,怎么回事?

 #include <stdio.h>

int main()

{

    int score[10]={67,98,75,63,82,79,81,91,66,84};

    int i;

int sum=0;

int number;

    if(i=0,i<10,i++)

    {

        sum+=score[i];    

    }

    return sum;

    if(score[i]>score[i+1])

    {

        score[i]=number; 

        score[i]=score[i+1];

        score[i+1]=number;

    }

    printf("%d/n",sum);

    printf("%d\n",sum/10);

    printf("%d/n",score[9]);

    printf("%d/n",score[0]);

    printf("%d\n",score[i]);

    return 0;


提问者:也许还会爱 2016-03-26 13:52

个回答

  • 青春如风般过往云烟
    2016-04-01 10:04:12

    #include <stdio.h>
    
    int main()
    {
    
        int score[10]={67,98,75,63,82,79,81,91,66,84};
        int i;
        int sum=0;
        int number;
        //if(i=0,i<10,i++)--怎么能这么用
        for(i=0;i<10;i++)
        {
            sum+=score[i];
        }
        //return sum;//------去掉
        for(i = 0;i < 9;i++)//升序排序
        {
            if(score[i]>score[i+1])
            {
                //score[i]=number;
                number = score[i];
                score[i]=score[i+1];
                score[i+1]=number;
            }
        }
        //printf("%d/n",sum);
        printf("%d\n",sum);
        printf("%d\n",sum/10);
        //printf("%d/n",score[9]);
        //printf("%d/n",score[0]);
        printf("%d\n",score[9]);
        printf("%d\n",score[0]);
        printf("%d\n",score[i]);
        return 0;
    
    }


  • 少得当年双美
    2016-03-26 16:16:01

    你没有定义number是什么