//8578 顺序表逆置
#include <stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
int array[n+1];
int reverseArray[n+1];
for(i=1;i<=n;i++)
{
scanf("%d",&array[i]);
}
printf("The List is:");
for(i=1;i<=n;i++)
{
printf("%d ",array[i]);
}
printf("\n");
for(i=1;i<=n;i++)
{
reverseArray[i]=array[n+1-i]; //顺序表逆置
}
printf("The turned List is:");
for(i=1;i<=n;i++)
{
printf("%d ",reverseArray[i]);
}
return 0;
}
8578 顺序表逆置
最新推荐文章于 2023-02-28 13:50:04 发布