오늘의 C# 공부 by 김윤정

using System;


////switch 문
//namespace Switch
//{
//    class HelloWorld
//    {
//        static void Main(string[] args)
//        {
//            Console.Write("요일을 입력하세요. (일,월,화,수,목,금,토) :  ");
//            string day = Console.ReadLine();

//            switch (day)
//            {
//                case "일" :
//                    Console.WriteLine ("Sunday");
//                    break;

//                case "월":
//                    Console.WriteLine("Monday");
//                    break;

//                case "화":
//                    Console.WriteLine("Tuesday");
//                    break;
                   
//                case "수":
//                    Console.WriteLine("Wednesday");
//                    break;

//                case "목":
//                    Console.WriteLine("Thursday");
//                    break;

//                case "금":
//                    Console.WriteLine("Friday");
//                    break;

//                case "토":
//                    Console.WriteLine("Saturday");
//                    break;


//                default:
//                    Console.WriteLine("{0}은 요일이 아닙니다",day);
//                    break;

//            }
//        }
//    }
//}


////반복문 연습
//namespace While
//{
//    class HelloWorld
//    {
//        static void Main(string[] args)
//        {
//            int i = 10;

//            while (i > 0)
//            {
//                Console.WriteLine("i : {0}", i--);
//            }
//        }
//    }
//}

////do while문
//namespace DoWhile
//{
//    class HellowWorld
//    {
//        static void Main()
//        {
//            int i = 10;

//            do
//            {
//                Console.WriteLine("a) i: {0}", i--);
//            }
//            while (i > 0);

//            do
//            {
//                Console.WriteLine("b) i : {0}", i--);
//            }
//            while (i > 0);

//        }
//    }
//}

 

////for 문
//namespace For
//{
//    class HelloWorld
//    {
//        static void Main()
//        {
//            for (int i = 0; i < 5; i++)
//            {
//                Console.WriteLine("{0}",i);
//            }
//        }
//    }
//}

 

////중첩 for 문
//namespace ForFor
//{
//    class HelloWorld
//    {
//        static void Main()
//        {
//            for (int i = 0; i < 5; i++)
//            {
//                for (int j = 0; j <= i; j++)
//                {
//                    Console.Write("*");
//                }
//                Console.WriteLine();
//            }
//        }
//    }
//}

 

//for문을 이용한 무한루프
//namespace InfiniteFor
//{
//    class HelloWorld
//    {
//        static void Main()
//        {
//            int i = 0;
//            for (; ; )
//            {
//                Console.WriteLine(i++);
//            }
//        }
//    }
//}

////break 점프문
//namespace Break
//{
//class HelloWorld
//{
//static void Main(string[] args)
//{
//    while (true)
//    {
//        Console.Write("계속할까요?(예/아니오) :");
//        string answer = Console.ReadLine();

//        if (answer == "아니오")
//            break;
//    }
//}
//}
//}

 

//// 테스트 1번
//namespace Test1
//{
//    class HelloWorld
//    {
//        static void Main()
//        {

//            for (int i = 5; i >= 1; i--)
//            {
//                for (int j = 1; j <= i; j++)
//                {
//                    Console.Write("A");
//                }
//                Console.WriteLine();
//            }
//        }
//    }
//}


////테스트 2번
//namespace Test2
//{
//    class HelloWorld
//    {
//        static void Main()
//        {
//            int k = 1;

//            for (int i = 4; i >= 0; i--)
//            {
//                for (int j = 0; j < i; j++)
//                {
//                    Console.Write(" ");
//                }

//                for (int j = 0; j < k; j++)
//                {
//                    Console.Write("*");
//                }
//                 k += 2;

//                Console.WriteLine();
//            }
//        }
//    }
//}




MyADD

<script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>