A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C# program to find out the leap years from 1900 to 1950
Q:

C# program to find out the leap years from 1900 to 1950

0

For example:

  • 1604 is a leap year.
  • 1605 is not a leap year.
  • 1600 is a leap year.
  • 1900 is not a leap year.
  •  

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Consider the program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    
    class Program
    {
        static void Main(string[] args)
        {
            int i     = 0;

            for (i = 1900; i <= 1950; i++)
            {   
                if( 
                    ((i % 4==0) && (i % 100 !=0)) ||
                    ((i % 4==0) && (i % 100 ==0) && (i%400==0)) 
                  )
                {
                    Console.Write(i + " ");
                }
            }

            Console.WriteLine();
        }
    }
}

Output

1904 1908 1912 1916 1920 1924 1928 1932 1936 1940 1944 1948

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now