C#/과제

2020.04.03. 과제 - 이중 for문

dev_sr 2020. 4. 3. 18:33
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Study_002
{
    class App
    {
        public App()
        {
            Console.WriteLine("2020-04-03");
            
            for(int i=0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Console.WriteLine("홍길동");
                }
 
                Console.WriteLine();
            }
 
            for(int i=0; i<5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    Console.Write("★");
                }
 
                Console.WriteLine();
                Console.WriteLine();
               
            }
            
 
 
            int count = 0;
 
            for(int i=0; i<5; i++)
            {
                count++;
 
                for (int j = 0; j < count; j++)
                {
                    Console.Write("★");
                }
 
                Console.WriteLine();
                Console.WriteLine();
                
 
            }
 
            int count2 = 5;
 
            for(int i=0; i<5; i++)
            {
                
 
                for(int j=0; j<count2; j++)
                {
                    Console.Write("★");
                }
 
                count2--;
 
                Console.WriteLine();
                Console.WriteLine();
                
            }
 
            
 
            for (int i = 0; i < 5; i++)
            {
               for(int j=0; j<(4-i); j++)
               {
                    Console.Write(" ");
               }
 
               for(int j= 0; j<=(i*2); j++)
               {
                    Console.Write("*");
               }
 
                Console.WriteLine();
 
            }
 
 
        }
    }
}
 
 

 

 

 

결과값