Console Programming/C# Console

3일차 줄넘기를 하려면 D키를 입력 해주세요.

폰타인 2019. 9. 20. 16:17
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax06
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("줄넘기를 하려면 d 키를 입력 해주세요.");
            ConsoleKeyInfo info = Console.ReadKey();
            bool condition = info.KeyChar == 'd';
            
            if (condition)
            {
                Console.Write("몇회 줄넘기를 할건가요? ");
                int count = Int32.Parse(Console.ReadLine());
 
                Console.Clear();
 
                for (int i = 1; i < count+1; i++)
                {
                    Console.WriteLine($"줄넘기를 {i}회 했습니다.");
                }
                
            }
            else
            {
                Console.WriteLine("줄넘기를 하지 못했습니다.");
            }
        }
    }
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter