提交记录 #136
提交时间:2024-11-05 21:27:26
语言:c
状态:CompileError
编译情况:编译错误
code.c: In function ‘main’:
code.c:12:9: error: unknown type name ‘f’
12 | f or (int i = left; i <= right; i++) {
| ^
code.c:12:21: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
12 | f or (int i = left; i <= right; i++) {
| ^
固定测试点暂不可用
附加测试点暂不可用
H13【选做•图形】晕
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int value = 1;
int top = 0, bottom = n - 1, left = 0, right = n - 1;
while (value <= n * n) {
f or (int i = left; i <= right; i++) {
printf("%3d", value++);
}
top++;
printf("\n");
for (int i = top; i <= bottom; i++) {
printf("%3d", value++);
}
right--;
printf("\n");
for (int i = right; i >= left; i--) {
printf("%3d", value++);
}
bottom--;
printf("\n");
for (int i = bottom; i >= top; i--) {
printf("%3d", value++);
}
left++;
printf("\n");
}
return 0;
}