c语言中利用对象宏式对数组元素进行倒序排列
标签:c语言 lease int i++ ever ret print div 语言
1、
#include #define NUMBER 5
int main(void)
{
int a[NUMBER];
int i;
puts("please input several numbers.");
for (i = 0; i )
{
printf("%dst = ", i + 1);
scanf("%d", &a[i]);
}
puts("-----\n-----\n-----");
int temp;
for (i = 0; i 2; i++)
{
temp = a[i];
a[i] = a[NUMBER-1-i];
a[NUMBER-1-i] = temp;
}
for (i = 0; i )
printf("a[%d] = %d\n", i, a[i]);
return 0;
}
2、
#include #define NUMBER 8
int main(void)
{
int a[NUMBER];
int i;
puts("please input several numbers.");
for (i = 0; i )
{
printf("%dst = ", i + 1);
scanf("%d", &a[i]);
}
puts("-----\n-----\n-----");
int temp;
for (i = 0; i 2; i++)
{
temp = a[i];
a[i] = a[NUMBER-1-i];
a[NUMBER-1-i] = temp;
}
for (i = 0; i )
printf("a[%d] = %d\n", i, a[i]);
return 0;
}
c语言中利用对象宏式对数组元素进行倒序排列
标签:c语言 lease int i++ ever ret print div 语言
原文地址:https://www.cnblogs.com/liujiaxin2018/p/14370466.html
评论