[1460]
#include <stdio.h>
#include <string.h>
//코드업
int main() {
int arr[101][101];
int n;
int x = 1;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
arr[i][j]=x++;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
printf("%d ", arr[i][j]);
}
printf("\n");
}
}
4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
[1461]
#include <stdio.h>
#include <string.h>
//코드업
int main() {
int arr[101][101];
int n;
int x = 1;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = n; j >= 1; j--) {
arr[i][j]=x++;
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <=n; j++) {
printf("%d ", arr[i][j]);
}
printf("\n");
}
}
4
4 3 2 1
8 7 6 5
12 11 10 9
16 15 14 13
728x90
'Dev. > Algorithm Prac' 카테고리의 다른 글
Baekjoon java / A+B (0) | 2022.04.20 |
---|---|
Beakjoon Java/ 2557 Hello World (0) | 2022.04.16 |
CodeUp c++ 1408 : 암호 처리 (0) | 2022.04.10 |
CodeUp c++ 1406 : love (0) | 2022.04.10 |
CodeUp c++ 1420 : 3등 찾기 (0) | 2022.04.09 |
댓글