Tech Study

C# Program to Check Leap Year

Introduction

Write C# Program to check leap year using conditional operator. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
namespace csharpprograms
{
    class Program
    {
        static void Main(string[] args)
        {
           int year;
           Console.WriteLine("Enter Year");
           year = Convert.ToInt32(Console.ReadLine());
           Console.WriteLine( year % 4 == 0 ? "Entered year is a leap" : "Not leap year");
           Console.ReadLine();        
 
           Console.ReadLine();
 
        }
    }
}

Result

Write C# Program to check leap year using conditional operator
Write C# Program to check leap year using conditional operator

 

Here are some more c# program for your practice ;

C# Program to check whether entered number is odd or even

C# Program to check uppercase or lowercase alphabets

TaggedWrite C# Program to check leap year using conditional operator

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more