method문 사용

Console(콘솔)/실습 2019. 9. 30. 13:10

입력된 시간값보다 45분 일찍 알람 맞추기!

using System;

 

namespace Syntax14

{

    class App

    {

        public App()

        {

            

            Alarm(1048);

        }

 

        

        public void Alarm(int a, int b)

        {

            int c = b - 45;

            int d = 60 - (-c);

            if (a >= 0 && b > 45)

            {

                Console.WriteLine($"{a} {c}");

            }

 

            else if (a > 0 && b <= 45)

            {

                Console.WriteLine($"{a - 1} {60 - (-c)}");

            }

            else if (a == 0 && b < 45)

            {

                Console.WriteLine($"23 {d}");

            }

        }

    }

}

 

 

 

 

'Console(콘솔) > 실습' 카테고리의 다른 글

class mathod  (0) 2019.10.02
Claas를 이용한 버거 만들기  (0) 2019.10.01
enum 문제  (0) 2019.09.27
두수를 입력받아 변수에 담기  (0) 2019.09.26
switch 예제문  (0) 2019.09.26
: