这个式子哪里出错了?并没有输出最大值。
Minerva 核心会员 2015-09-09 21:09:23
2954 1 0

#include <stdio.h>

#include <stdlib.h>

int main()

{

    int n,i,s,max;

    printf("请输入n:");

    scanf("%d",&n);   

printf("请输入%d个整数:",n);

    scanf("%d",&max);

    for(i=1;i<n;i++)

    {

    scanf("%d",&s);

    if(max<s)

      max=s;

    }

system("pause");

return 0;

}


问题来自: for循环实例

共 1 个回答

    最佳答案

    嘿嘿大人 一代宗师 3158天前

    #include <stdio.h>

    #include <stdlib.h>

    int main()

    {

        int n,i,s,max;

        printf("请输入n:");

        scanf("%d",&n);   

    printf("请输入%d个整数:",n);

        scanf("%d",&max);

        for(i=1;i<n;i++)

        {

        scanf("%d",&s);

        if(max<s)

          max=s;

        }

    printf("%d\n",max);

    system("pause");

    return 0;

    }

    你的问题是根本就没有输出语句蓝色部分,所以肯定不会输出啊


您还没有登录,所以不能回复该问题
我要回复

  • 0

    点赞

  • 扫一扫分享朋友圈

    二维码

  • 分享

相关问题