Write C# Program to check leap year using conditional operator

Write C# Program to check leap year using conditional operator


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..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2.  
  3. namespace csharpprograms
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int year;
  10. Console.WriteLine("Enter Year");
  11. year = Convert.ToInt32(Console.ReadLine());
  12. Console.WriteLine( year % 4 == 0 ? "Entered year is a leap" : "Not leap year");
  13. Console.ReadLine();
  14.  
  15. Console.ReadLine();
  16.  
  17. }
  18. }
  19. }
  20.  

Result

C# language techstudy.org

     





Related Topics




Popular Posts