Saturday, 5 March 2022

4. Write a C program to check given year is a Leap year or not.



#include<stdio.h>
#include<conio.h>

void main()
{
    int year;
    clrscr();

    printf("enter year: ");
    scanf("%d",&year);

    if(year % 4 == 0)
    {
        printf("\nyear is leap year");
    }
    else if(year % 400 == 0)
    {
        printf("\nyear is leap year");
    }
    else
    {
        printf("\nyear is not leap year");
    }
    getch();
}
/*      output:

enter year: 2020

year is leap year

*/ 

No comments:

Post a Comment

python programs

1. sum of two number