본문 바로가기

개발자/C#

Number Patterns Programs in C




Number Patterns Programs in C - 자료 출처 : Number Patterns Programs in C

http://cbasicprogram.blogspot.kr/2012/04/number-patterns.html



Related Links:

- More Number Pattern Programs  http://cbasicprogram.blogspot.in/2012/04/number-patterns.html

- Star Pattern Programs in C http://cbasicprogram.blogspot.in/2012/03/star-patterns.html

- Alphabet Pattern Programs in C http://cbasicprogram.blogspot.in/2013/03/alphabet-patterns.html

- Series Programs in C http://cbasicprogram.blogspot.in/2013/01/series-program.html




12345
1234
123
12
1
12345
2345
345
45
5
Code of above pattern


Code of above pattern


54321
4321
321
21
1
54321
5432
543
54
5
Code of above pattern


Code of above pattern


1
12
123
1234
12345
5
45
345
2345
12345
Code of above pattern


Code of above pattern


1
21
321
4321
54321
5
54
543
5432
54321
Code of above pattern


Code of above pattern


1
22
333
4444
55555
5
44
333
2222
11111
Code of above pattern


Code of above pattern


55555
4444
333
22
1
11111
2222
333
44
5
Code of above pattern


Code of above pattern


12345
4321
123
21
1
1234567
12345
123
1
Code of above pattern


Code of above pattern


1
01
101
0101
13579
3579
579
79
9
Code of above pattern


Code of above pattern


1
2 4
1 3 5
2 4 6 8
1 3 5 7 9
55555
45555
34555
23455
12345
Code of above pattern


Code of above pattern


1
23
456
78910
1
10
101
1010
10101
Code of above pattern


Code of above pattern


1 
2 6 
3 7 10 
4 8 11 13 
5 9 12 14 15
1
123
12345
1234567
Code of above pattern


Code of above pattern


12344321
123**321
12****21
1******1
    1
  2 3 4
5 6 7 8 9
Code of above pattern


Code of above pattern


1   2   3   4   5   6   7   8   9   10
36  37  38  39  40  41  42  43  44  11
35  64  65  66  67  68  69  70  45  12
34  63  84  85  86  87  88  71  46  13
33  62  83  96  97  98  89  72  47  14
32  61  82  95  100 99  90  73  48  15
31  60  81  94  93  92  91  74  49  16
30  59  80  79  78  77  76  75  50  17
29  58  57  56  55  54  53  52  51  18
28  27  26  25  24  23  22  21  20  19
Code of above pattern


11111
2222
333
22
1
5432*
543*1
54*21
5*321
*4321
Code of above pattern


Code of above pattern


1
121
12321
1234321
0 
909 
89098 
7890987 
678909876 
56789098765 
4567890987654 
345678909876543 
23456789098765432 
1234567890987654321 
Code of above pattern


Code of above pattern


1        1
12      21
123    321
1234  4321
1234554321
    1
   21
  321
 4321
54321 
Code of above pattern


Code of above pattern


1
232
45654
78910987
1
2*2
3*3*3
4*4*4*4
4*4*4*4
3*3*3
2*2
1
Code of above pattern


Code of above pattern


11
12 13
13 14 15
14 15 16 17
             1
           2 3
         4 5 6
      7 8 9 10
11 12 13 14 15
Code of above pattern


Code of above pattern


    5
   54
  543
 5432
54321
1
212
32123
4321234
Code of above pattern


Code of above pattern


1
23
345
4567
56789
  1  2  3  4  5
  6  7  8  9
 10 11 12
 13 14
 15
Code of above pattern


Code of above pattern


1234
2341
3421
4321
11111
0000
111
00
1
Code of above pattern


Code of above pattern


                  1  
              4   9  16 
         25  36  49  64  81 
    100 121 144 169 196 225 256 
289 324 361 400 441 484 529 576 625
11111
1   1
1   1
1   1
11111 
Code of above pattern


Code of above pattern


    1 
   1 2 
  1 2 3 
 1 2 3 4 
1 2 3 4 5
    1
   123
  12345
 1234567
123456789
 1234567
  12345
   123
    1
Code of above pattern


Code of above pattern


*000*000*
0*00*00*0
00*0*0*00
000***000
5 5 5 5 5 5 5 5 5 
5 4 4 4 4 4 4 4 5 
5 4 3 3 3 3 3 4 5 
5 4 3 2 2 2 3 4 5 
5 4 3 2 1 2 3 4 5 
5 4 3 2 2 2 3 4 5 
5 4 3 3 3 3 3 4 5 
5 4 4 4 4 4 4 4 5 
5 5 5 5 5 5 5 5 5
Code of above pattern


Code of above pattern


1
1 1
1 2 1
1 3 3 1 
1 4 6 4 1
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
Code of above pattern


Code of above pattern


1 
1 2 
3 5 8 
13 21 34 55 
89 144 233 377 610
11111
10001
10001
10001
11111
Code of above pattern


Code of above pattern


1 2 3 4 5 
2 1 2 3 4 
3 2 1 2 3 
4 3 2 1 2 
5 4 3 2 1 
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
Code of above pattern


Code of above pattern


1
232
34543
4567654
567898765 
1     1
 2   2 
  3 3  
   4   
  3 3  
 2   2 
1     1
Code of above pattern


Code of above pattern

1     
2 6    
3 7 10   
4 8 11 13  
5 9 12 14 15  
        1       
      1 2 1     
    1 2 3 2 1   
  1 2 3 4 3 2 1 
1 2 3 4 5 4 3 2 1
Code of above pattern


Code of above pattern

      1
    2   2
  3       3
4           4
  3       3
    2   2
      1
1  2  3  4  5  
16          6  
15          7  
14          8  
13 12 11 10 9 
Code of above pattern


Code of above pattern


N=39714

3 9 1 7 4
9 1 7 4
1 7 4
7 4
4
Code of above pattern





Related Links:
Star Patterns
http://cbasicprogram.blogspot.in/2012/03/star-patterns.html

Alphabet Patterns
http://cbasicprogram.blogspot.in/2013/03/alphabet-patterns.html

Series Programs
http://cbasicprogram.blogspot.in/2013/01/series-program.html



그 외 패턴들...



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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
 
1
123
12345
1234567
12345
123
1
 
for(i=1;i<=7;i+=2)
{
    for(j=1;j<=i;j++)
        printf("%d",j);
    printf("\n");
}
for(i=5;i>=1;i-=2)
{
    for(j=1;j<=i;j++)
        printf("%d",j);
    printf("\n");
}
 
1 5 8 10
2 6 9
3 7
4
 
for(i=1;i<=4;i++)
{
    printf("%d",k=i;);
    for(j=4;j>i;j--)
        printf("%d",k+=j);
    printf("\n");
}
 
11111
22222
33333
44444
55555
 
for(i=1;i<=5;i++)
{
    for(j=1;j<=5;j++)
        printf("%d",i);
    printf("\n");
}
 
12345
12345
12345
12345
for(i=1;i<=5;i++)
{
    for(j=1;j<=5;j++)
        printf("%d",j);
    printf("\n");
}
 
1234321
123 321 
12 21
1 1
 
void main()
{
    int i,j,k;
    for(i=4;i>=1;i--)
    {
        for(j=1;j<=4;j++)
        {
            if(j<=i)
                printf("%d",j);
            else
                printf(" ");
        }
        for(j=3;j>=1;j--)
        {
            if(j<=i)
                printf("%d",j);
            else
                printf(" ");
        } 
        printf("\n");
    }
}
 
z y x w v w x y z
z y x w x y z
z y x y z
z y z
z
 
void main()
{
    int i,j;
    clrscr();
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=i;j++)
            printf("%c ",123-j);
        for(j-=2;j>=1;j--)
            printf("%c ",123-j);
        printf("\n");
    }
    getch();
}
 
1 2 3 4 5
.4 3 2 1
..1 2 3
....2 1
.....1
 
for(i=5;i>=1;i--)
{
    for(j=5;j>i;j--)
    {
        printf(" ");
    }
    for(k=1;k<=i;k++)
    {
        printf("%d ",k);
    }
    printf("\n");
}
 
How to print this
ABCDEFEDCBA
ABCDE.EDCBA
ABCD…..DCBA
ABC……….CBA
AB……………BA
A……………...A
plzz help!! Dots are spaces …
 
void main()
{
    int i,j,k;
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=5;j++)
        {
            if(j<=i)
                printf("%c",'A' + j-1);
            else
                printf(" ");
        }
        for(j=4;j>=1;j--)
        {
            if(j<=i)
                printf("%c",'A' + j-1);
            else
                printf(" ");
        } 
        printf("\n");
    }
}
 
1
1
2
12
3
123
4
1234
 
int main()
{
    int i, j;
    for(i=1;i<=4;i++)
    {
        printf("%d\n",i);
        for(j=1;j<=i;j++)
        {
            printf("%d",j);
        }
        printf("\n");
    }
}
 
A
11
BBB
22222
CCCCC
 
void main()
{
    int i, j;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            if(i%2==0)
                printf("%d",i/2);
            else
                printf("%c",'A' + i/2);
        }
        printf("\n");
    }
}
 
54321
_5432
__543
___54
____5
 
main()
{
    int i,j;
    for(i=5;i>=1;i--)
    {
        for(j=5;j>=1;j--)
        {
            if(j>i)
                printf(" ");
            else
                printf("%d",j);
        }
        printf("\n");
    }
}
 
____5
___45
__345
_2345
12345
 
main()
{
    int i,j;
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=5;j++)
        {
            if(j<i)
                printf(" ");
            else
                printf("%d",j);
        }
        printf("\n");
    }
}
 
54321
*4321
**321
***21
****1
 
main()
{
    int i,j;
    for(i=5;i>=1;i--)
    {
        for(j=5;j>=1;j--)
        {
            if(i<j)
                printf(" ");
            else
                printf("%d",j);
        }
        printf("\n");
    }
}
 
12345
*2345
**345
***45
****5
 
main()
{
    int i,j;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=5;j++)
        {
            if(j<i)
                printf(" ");
            else
                printf("%d",j);
        }
        printf("\n");
    }
}
 
****5
***45
**345
*2345
12345
 
main()
{
    int i,j;
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=5;j++)
        {
            if(j<i)
                printf(" ");
            else
                printf("%d",j);
        }
        printf("\n");
    }
}
 
c
co
com
comp
compu
comput
compute
computer
 
#include
#include
int main()
{
    char s[]="computer";
    int i,j;
    for(i=0;s[i];i++)
    {
        for(j=0;j<=i;j++)
            printf("%c",s[j]);
        printf("\n");
    }
    return 0;
}
 
1 2 3 4 4 3 2 1
1 2 3 3 2 1
1 2 2 1
1 1
 
void main()
{
    int i,j,k;
    for(i=4;i>=1;i--)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d",j);
        }
        for(j=i;j>=1;j--)
        {
            printf("%d",j);
        } 
        printf("\n");
    }
}
 
1
232
23432
 
printf("1\n");
for(i=3;i<=4;i++)
{
    for(j=2;j<=i;j++)
        printf("%d",j);
    for(j=i-1;j>=2;j--)
        printf("%d",j);
    printf("\n");
}
 
*##
#*#
##*
 
for(i=1;i<=3;i++)
{
    for(j=1;j<=3;j++)
    {
        if(i==j) printf("*");
        else printf("#");
    }
    printf("\n");
}
 
*
*A*
*A*A*
*A*A*A*
 
for(i=1;i<=5;i++)
{
    for(j=1;j<=i;j++)
    {
    if(j%2==0printf("A");
    else printf("*");
    }
    printf("\n");
}
 
1
23
456
7890
12345
 
int main()
{
    int i,j,k;
    k=1;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            if(k==10) k=0;
                printf("%d",k++);
        }
        printf("\n");
    }
}
 
cs



이미지 출처 : https://www.slideshare.net/punkt402/6-4-36617534