본문 바로가기
C#

조건문

by 띰쥬 2024. 12. 4.
728x90
반응형
SMALL

간단히 점수 입력해서 점수에 따른 결과를 출력하는 예제

 

internal class IfDemo
{
    static void Main(string[] args)
    {
        Console.WriteLine("Input Score(math)");
        string math = Console.ReadLine();
        int math_score = Convert.ToInt32(math);
        Console.WriteLine("Input Score(science)");
        string science = Console.ReadLine();
        int science_score = Convert.ToInt32(science);

        if(math_score < 50)
        {
            Console.WriteLine("You Got Failed in Math");
        }

        if (science_score < 50)
        {
            Console.WriteLine("You Got Failed in Science");
        }
    }
}

 

 

728x90
반응형
LIST

'C#' 카테고리의 다른 글

반복문  (0) 2024.12.04
기본 문법  (1) 2022.05.04
C# 개발 환경 구축  (1) 2022.05.01
C# 소개  (0) 2022.05.01