Created
February 24, 2022 17:51
-
-
Save shivam-gupta007/f4b8ff9b129d263a59e11235208a8550 to your computer and use it in GitHub Desktop.
C# lab assignment Programs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class MyClass | |
{ | |
public static void Main(string[] args) | |
{ | |
int year; | |
Console.WriteLine("Enter a year: "); | |
year = Convert.ToInt32(Console.ReadLine()); | |
if(year%400 == 0) | |
Console.WriteLine(year + " is a leap year"); | |
else if(year%100 == 0) | |
Console.WriteLine(year + " is not a leap year"); | |
else if(year%4 == 0) | |
Console.WriteLine(year + " is a leap year"); | |
else | |
Console.WriteLine(year + " is not a leap year"); | |
} | |
} | |
/* | |
OUTPUT - | |
Enter a year: | |
2022 | |
2022 is not a leap year | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment