C#/C#200제

[C#] 8일차 - 54. 이중 루프를 이용하여 구구단 출력

반나무 2021. 1. 23. 10:40

다양한 방법이 있지만 가로로 한줄 나오고 \n되는 기법을 사용

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

namespace A054_TimesTable
{
    class Program
    {
        static void Main(string[] args)
        {
            for(int y=1; y<=9; y++)
            {
                for(int x=2; x<=9; x ++)
                {
                    Console.Write("{0} X {1} = {2,2}  ", x, y, x * y);
                }
                Console.WriteLine();
            }
        }
    }
}

반응형