Monday, 23 April 2018

Find Leap year or not Leap year in C# Console Application

Find Leap year or not Leap year in C# Console Application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int y;
            Console.Write("enter the year...>");
            y = Convert.ToInt16(Console.ReadLine());
            if ((y % 4 == 0 && y % 100!=0)||(y % 400 == 0))
                Console.WriteLine("{0} is a leap year");
            else
                Console.WriteLine("{0} is not a leap year");
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment