Login to ask a question from C programs on various integers

C Program to check Leap Year:

This program checks whether the input year is leap year or not.

You can check whether a year is leap or not by using this mathematical logic:

Leap Year:

  • If a year is divisible by 4, 100 and 400 then it is a leap year.

  • If a year is divisible by 4 but not divisible by 100 then it is a leap year

Not a Leap Year:

  1. If a year is not divisible by 4 then it is not a leap year

  2. If a year is divisible by 4 and 100 but not divisible by 400 then it is not a leap year

Source Code:

#include

int main()

{

    int y;


    printf("Enter year: ");

    scanf("%d",&y);


    if(y % 4 == 0)

    {

        //Nested if....

Show More
Previous Question Next Question
🔗

Similar Questions

From C programs on various integers · C programming

View All
WhatsApp