Advertisement
SMASIF

C# - Leap Year Or Not

Mar 10th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace LeapYearApp
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int num;
  14.  
  15.             Console.WriteLine("Input number: ");
  16.             num = Convert.ToInt32(Console.ReadLine());
  17.  
  18.             if(num % 4 ==0 && num % 100!=0 || (num % 400 == 0))
  19.             {
  20.                 Console.WriteLine(num + " is a Leap Year");
  21.             }
  22.            
  23.             else
  24.             {
  25.                 Console.WriteLine(num + " is not a Leap Year");
  26.             }
  27.  
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement