1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include <stdio.h>
void nrpira_1(int n);
int main(void)
{
int n;
while(1)
{
printf("input:");
scanf("%d",&n);
if(n<0)
{
break;
}
nrpira_1(n);
}
return 0;
}
void nrpira_1(int n)
{
/*
1111111
t22222
tt333
ttt4
*/
int i,j;
char temp=32;
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
printf("%c",temp);
}
for(j=i*2;j<n*2-1;j++)
{
printf("%d",i+1);
}
printf("\n");
}
}
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
-------------------------------------------------------------------------------
바람개비
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include <stdio.h>
int main()
{
int i,j;
/*
*tttt****
**ttt***
***tt**
****t*
*/
int n;
while(1)
{
printf("input:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("*"); // 1 2 3 4 5 ~~
}
for(j=n;j>i;j--) //4 > 0
{
printf(" "); // 5 4 3 2 1 ~~
}
for(j=n;j>i;j--)
{
printf("*"); // 5 4 3 2 1
}
printf("\n");
}
for(i=0;i<n;i++)
{
for(j=n;j>i;j--)
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf("*");
}
for(j=0;j<=i;j++)
{
printf(" ");
}
for(j=n;j>i;j--)
{
printf("*");
}
printf("\n");
}
}
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
'IT 관련 공부 > 자료구조와 알고리즘 (C)' 카테고리의 다른 글
이진 검색 binary search (0) | 2019.07.17 |
---|---|
선형검색, 선형검색 보초법 (0) | 2019.07.09 |
진수변환 프로그램 (0) | 2019.07.05 |
Chap01 중간 값 구하기, 피라미드 별찍기 (0) | 2019.07.01 |
자료구조와 알고리즘 스터디 시작합니다. (0) | 2019.07.01 |