#include <stdio.h>
// 1. n의 수만큼 빈칸을 출력함.
// 2. 31개의 숫자를 출력함.
// 3. 그런데 1,2 를 하면서 count 로 출력한 횟수를 세어서 count 가 7의 배수가 될때마다
// '\n'을 출력해줌
// 1. 한자리 숫자일때는 한칸 띄워서 출력
int main() {
int n;
int count = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
printf(" ");
count++;
}
for (int i = 1; i < 32; i++) {
if ((count % 7) == 0) {
printf("\n");
}
count++;
if(i < 10) printf(" %d ", i);
else printf("%d ", i);
}
// if (n == 0) {
// for (int i = 0; i < 31; i++) {
// for (int j = 0; j < 7; j++) {
// printf()
// }
// }
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: