题目:输入5个数,利用数组倒序输出
直接上代码。。。
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int a[5],n=0,k=4;
for(int j=1;j<=5;j++)
{
cin>>a[n];
n++;
}
for(int j=1;j<=5;j++)
{
cout<<a[k]<<" ";
k--;
}
return 0;
}
输入:1 2 3 4 5
输出: