More actions
imported>rokkiho No edit summary |
(Repair batch-0005 pages from live compare) |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
= 여기다 과제를 올려주세요 = | = 여기다 과제를 올려주세요 = | ||
== 별 찍기 | == 별 찍기 == | ||
1 1 | |||
2 2 | |||
3 3 | |||
4 4 | |||
5 | |||
6 6 | |||
7 7 | |||
8 8 | |||
9 9 | |||
<해답> | |||
#include <stdio.h> | |||
int main(void){ | |||
int i=0,j=0; | |||
for(i=0;i<9;i++){ | |||
for(j=0;j<(i<=4?i:8-i);j++) | |||
printf(" "); | |||
printf("%d",i+1); | |||
for(j=0;j<(i<=4?7-2*i:2*(i-4)-1);j++) | |||
printf(" "); | |||
if(i!=4) | |||
printf("%d",i+1); | |||
printf("\n"); | |||
} | |||
return 0; | |||
} | |||
Latest revision as of 00:45, 27 March 2026
여기다 과제를 올려주세요
별 찍기
1 1
2 2
3 3
4 4
5
6 6
7 7
8 8
9 9
<해답>
#include <stdio.h>
int main(void){
int i=0,j=0;
for(i=0;i<9;i++){
for(j=0;j<(i<=4?i:8-i);j++)
printf(" ");
printf("%d",i+1);
for(j=0;j<(i<=4?7-2*i:2*(i-4)-1);j++)
printf(" ");
if(i!=4)
printf("%d",i+1);
printf("\n");
}
return 0;
}