---
title: "Write a C# program to check Leap year?"  
description: "Write a C# program to check Leap year?"  
author: "Steilla Mitchel"  
published: 2021-11-21  
updated: 2021-11-21  
canonical: https://www.mindstick.com/forum/156857/write-a-c-sharp-program-to-check-leap-year  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Write a C# program to check Leap year?

Write a C# [program to check](https://www.mindstick.com/forum/157542/write-a-java-program-to-check-if-a-list-of-integers-contains-only-odd-numbers) [Leap year](https://www.mindstick.com/forum/158828/implement-a-function-to-check-if-a-given-year-is-a-leap-year-or-not-using-rust)?

## Replies

### Reply by Ashutosh Kumar Verma

## Leap Year:

Leap year is a year in which the day is 366 instead of 365 because there are 29 days in February month. We can find all the leap year by using the following [C# program](https://www.mindstick.com/forum/156830/how-do-i-make-a-c-sharp-program-that-checks-for-given-array-by-user-which-elements-are-perfect-numbers).

## Program:

```
using System;
public class Program
{
 public static void Main()
 {
int num=2018, i;
  if((num%400==0)||(num%4==0 && num%100!=0))
  {
  Console.WriteLine('is Leap Year');
  }else
  {
  Console.WriteLine('not Leap Year');
  }
}
}
```

```
Output:     not Leap Year
```

**Program for Taking input a year by user to [check](https://yourviews.mindstick.com/story/2248/never-forget-to-check-these-specifications-before-buying-a-mobile-phone) that is Leap year or not.**

```
using System;
public class Program
{
 public static void Main()
 {
  int num;
  Console.WriteLine('Enter an year to check whether is Leap year or not');
  num=int.Parse(Console.ReadLine());
  if(num%4==0)
  {
   if(num%100!=0)
   {
    if(num%400==0)
    {
      Console.WriteLine(num+' is a Leap year');
    }else
     Console.WriteLine(num+' is a Leap year');
   }else
   {
   Console.WriteLine(num+' not a leap year');
   }
  }else
  {
  Console.WriteLine('not a leap year');
  }
 }
}
```

## Output:

```
Enter an year to check whether is Leap year or not
2020
2020 is a Leap year
```

\


---

Original Source: https://www.mindstick.com/forum/156857/write-a-c-sharp-program-to-check-leap-year

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
