Advertisement
mecies

LEAP YEAR

Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. Console.WriteLine("Give me a year and i will tell u wether its a leap year or not");
  4. int given_year = Convert.ToInt32(Console.ReadLine());
  5. Leap_Year_Function(given_year);
  6. Console.ReadKey();
  7.  
  8. }
  9. public static int Leap_Year_Function(int given_year)
  10. {
  11.  
  12. if (given_year % 4 == 0 && given_year % 100 != 0)
  13. {
  14. Console.WriteLine(given_year + " is a leap year");
  15. return given_year;
  16. }
  17. if (given_year % 400 == 0)
  18. {
  19. Console.WriteLine(given_year + " is a leap year");
  20. return given_year;
  21. }
  22. else
  23. {
  24. Console.WriteLine(given_year + " is not a leap year");
  25. return given_year;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement