数组逆序

来源:互联网 发布:投资域名需要解析吗 编辑:程序博客网 时间:2024/05/05 09:00

Problem E: C语言实验——数组逆序

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 615  Solved: 207
[Submit][Status][Web Board]

Description

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

Input

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

Output

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

Sample Input

1 3 5 9 7 6 8 2 4 0

Sample Output

0 4 2 8 6 7 9 5 3 1

HINT

#include <iostream> using namespace std; int main() {     int i,a[10];     for(i=0;i<=9;i++)         cin>>a[i];     for(i=9;i>=0;i--) {if (i>0)             cout<<a[i]<<" ";         else            cout<<a[i]; }return 0; } 


 

0 0
原创粉丝点击