将一个数组逆序输出。
#include <stdio.h>
#define N 10
int main()
{
int a[N]={0,1,2,3,4,5,6,7,8,9};
int i,t;
printf("原数据为:\n");
for(i=0;i<N;i++)
{
printf("%d ",a[i]);
}
for(i=0;i<N/2;i++)
{
t=a[i];
a[i]=a[N-1-i];
a[N-1-i]=t;
}
printf("\n排列后数据为:\n");
for(i=0;i<N;i++)
{
printf("%d ",a[i]);
}
printf("\n");
return 0;
}
标签:输出,10,int,数组,main,逆序
From: https://www.cnblogs.com/yesiming/p/17432871.html