ellapt

T11.1.LeapYear

Jan 25th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using System;
  2.  
  3. class LeapYear
  4. {
  5. static void Main()
  6. {
  7. Console.WriteLine("Read a year from the console and check whether it is leap");
  8. int year;
  9. string strNum;
  10. do
  11. {
  12. Console.Write("Enter year: ");
  13. }
  14. while (!int.TryParse(strNum = Console.ReadLine(), out year) || year <= 0);
  15. Console.WriteLine("Is {0} leap year? {1}", year, DateTime.IsLeapYear(year));
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment