C#/알고리즘
4. 2753번 윤년
dev_sr
2020. 4. 26. 11:05
윤년일 때는 1 출력
아니면 0 출력
1. 코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _2753
{
class Program
{
static void Main(string[] args)
{
int input = Convert.ToInt32(Console.ReadLine());
if(input%4==0 && input%100!=0 || input%400==0)
{
Console.WriteLine(1);
}
else
{
Console.WriteLine(0);
}
}
}
}
|
2. 결과값
1) 윤년일때

2) 아닐때

출처