using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Study02
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("구구단을 출력할 숫자를 입력하시오(2~9)");
            int dan = Convert.ToInt32(Console.ReadLine());

            if (dan >= 2 && dan <= 9)
            {
                for (int i = 0; i < 9; i++)
                {
                    int num = i + 1;
                    Console.WriteLine("{0} x {1} = {2}", dan, num, dan * num);
                }
            }
            else
            {
                Console.WriteLine("잘못된 수를 입력하였습니다.");
            }
        }
    }
}

'C# > 수업 내용' 카테고리의 다른 글

반복문 1~선택한 수 만큼의 정수의 합 구하기  (0) 2023.01.03
반복문 두 수의 합 구하기  (0) 2023.01.03
if문 종족 선택  (0) 2023.01.02
고블린1  (0) 2023.01.02
늑대1  (0) 2023.01.02

+ Recent posts