2019/09/19 for 루프
C#/실습 2019. 9. 19. 10:58문제 종합:

코드:
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax01
{
class Program
{
static void Main(string[] args)
{
for (int counter=1; counter<=10; counter++)
{
Console.WriteLine("Hello World!");
}
Console.WriteLine("*** 날짜 ***");
for (int counter=1; counter <=12; counter++)
{
Console.WriteLine(counter +"월");
}
Console.WriteLine("*** 구구단 2단 ***");
for (int i = 1; i <= 9; i++)
{
Console.WriteLine($"2 X {i} = {i * 2}");
}
Console.WriteLine("*** 별찍기 ***");
string a = "*";
for (int i = 1; i<=5; i++)
{
Console.Write(a);
Console.WriteLine();
a = a + "*";
}
Console.WriteLine("*** 별찍기2 ***");
string a2 = "*";
for (int counter = 1; counter <= 4; counter++)
{
if (counter == 1)
{
Console.Write(" ");
}
else if (counter == 2)
{
Console.Write(" ");
}
else if (counter == 3)
{
Console.Write(" ");
}
else if (counter == 4)
{
Console.Write(" ");
}
Console.Write(a2);
Console.WriteLine();
a2 = a2 + "*";
}
Console.WriteLine("*** 별찍기3 ***");
for (int counter = 1; counter <= 5; counter++)
{
Console.WriteLine("*****");
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'C# > 실습' 카테고리의 다른 글
09.23 상점 구매하기 및 판매하기 (0) | 2019.09.23 |
---|---|
09.20 줄넘기 (0) | 2019.09.20 |
09.20 for문을 이용한 던전게임 (0) | 2019.09.20 |
09.20 과일입력, 숫자입력, 문자열에 따옴표입력 (0) | 2019.09.20 |
구구단 (convert를 이용한 string형식을 int 형식으로 변환, tryparse를 이용한 문자와 숫자 구분) (0) | 2019.09.19 |