忧郁的罗宾汉


私信TA

用户名:dotcpp0657701

访问量:128

签 名:

等  级
排  名 12279
经  验 942
参赛次数 0
文章发表 5
年  龄 0
在职情况 学生
学  校 浙江商业职业技术学校
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#include "stdio.h"

    int a[80], max, min, t, temp;

int main() {

    printf("please,input ten number:");

    for (int i = 0; i < 10; i++) {

        scanf("%d", &a[i]);

    }

    max = a[0];

    for (int i = 0; i < 10; i++) {

        if (a[i] > max) {

            max = a[i];

            t = i;

        }

    }

    temp = a[t];

    a[t] = a[9];

    a[9] = temp;

    min = a[0];

    for (int i = 0; i < 10; i++) {

        if (a[i] < min) {

            min = a[i];

            t = i;

        }

}

    temp = a[0];

    a[0] = a[t];

    a[t] = temp;

    for (int i = 0; i < 10; i++) {

        printf("%d ", a[i]);

    }

}


 

0.0分

0 人评分

  评论区