C语言实验——数组逆序

    xiaoxiao2021-12-14  20

    Problem Description

    输入10个整数存入一维数组,按逆序重新存放后再输出。

    Input

    输入包括一行。 10个以空格隔开的整数。

    Output

    逆序的10个整数,整数以空格隔开。

    Example Input

    1 3 5 9 7 6 8 2 4 0

    Example Output

    0 4 2 8 6 7 9 5 3 1

    #include<stdio.h>    int main()   {       int a[10],i;       for(i=0;i<10;i++)       {           scanf("%d",&a[i]);       }       for(i=9;i>=0;i--)       { if(i==0) printf("%d\n",a[i]);         else printf("%d ", a[i]);     }       return 0;   }

    转载请注明原文地址: https://ju.6miu.com/read-971913.html

    最新回复(0)