verifying whether the given year is leapyear or not

Raj_Chennai
Posted by Raj_Chennai under C# category on | Points: 40 | Views : 1286
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace leapyear
{
class Program
{
static void Main(string[] args)
{
int yr;
Console.WriteLine("enter the year");
yr = Convert.ToInt32(Console.ReadLine());
if ((yr % 4 == 0) && (yr % 100 != 0 || yr % 400 == 0))
{
Console.WriteLine("the year given as input is leapyear{0}",yr);
}
else
{
Console.WriteLine("the year given as input is not a leapyear{0}", yr);
}
Console.ReadLine();
}
}
}

Comments or Responses

Posted by: Shubham on: 3/10/2012 Level:Starter | Status: [Member] | Points: 10
raj i m looking us codes and i m very upset wid this codes every codes are carry linq namespace and this will generate error....
Posted by: Raj_Chennai on: 3/12/2012 Level:Starter | Status: [Member] | Points: 10
hi,
just remove the namespace "Using system.LINQ" then all code will work.The code which i shared is in visualstudio2010 so by default it provide this namespace

Login to post response