标签:nbsp include 10个 代码 scanf str 整数 div std
代码1:
#include <stdio.h> int main() { int a[10], b[10]; int i,j; printf("请输入10个整数:\n"); for (i = 0; i < 10; i = i + 1) scanf_s("%d", &a[i]); for (i = 0,j=9; i < 10; i = i + 1,j=j-1) { b[j] = a[i]; } for (j = 0; j < 10; j = j + 1) printf("%-3d", b[j]); }
代码2:
#include <stdio.h> int main() { int a[10], t; int i; printf("请输入10个整数:\n"); for (i = 0; i < 10; i = i + 1) scanf_s("%d", &a[i]); for (i = 0; i < 5; i = i + 1) { t = a[i]; a[i] = a[9 - i]; a[9 - i] = t; } for (i = 0; i < 10; i = i + 1) printf("%-3d", a[i]); }
标签:nbsp include 10个 代码 scanf str 整数 div std
原文地址:https://www.cnblogs.com/HGNET/p/11919689.html