백준

백준 5086번 c#

대왕군 2024. 1. 30. 15:51

 

using System;

namespace Baekjoon
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음)
            Console.BackgroundColor = ConsoleColor.DarkCyan;

            //입력값 넣을 변수
            string[] input;

            //입력값 0 0 나올때까지 무한 반복
            while (true)
            {
                //값 입력
                input = Console.ReadLine().Split();
                //입력값 0 0이면 반복문 중단
                if (int.Parse(input[0]) == 0 && int.Parse(input[1]) == 0)
                {
                    break;
                }
                //첫번째 숫자가 두번째 숫자의 약수일경우
                else if (int.Parse(input[1]) % int.Parse(input[0]) == 0)
                {
                    Console.WriteLine("factor");
                }
                //첫번째 숫자가 두번째 숫자의 배수일경우
                else if (int.Parse(input[0]) % int.Parse(input[1]) == 0)
                {
                    Console.WriteLine("multiple");
                }
                //둘 다 아닐경우
                else
                {
                    Console.WriteLine("neither");
                }

            }

        }

    }
}

 

갑자기 난이도가 확 낮아져서 당황했다

'백준' 카테고리의 다른 글

백준 9506번 c#  (0) 2024.01.30
백준 2501번 c#  (0) 2024.01.30
백준 2869번 c#  (0) 2024.01.28
백준 1193번 c#  (0) 2024.01.27
백준 2292번 c#  (0) 2024.01.27