Wednesday, September 5, 2018

14. WAP to determine whether a year is a leap year or not - METHOD 3.

#include <stdio.h>
#include<conio.h>
int main()
{
    int yr;
    printf("Enter a year: ");
    scanf("%d",&yr);
    if( ((yr%4==0) && (yr%100!=0)) || (yr%400==0) )
        printf("%d is a leap year", yr);
    else
        printf("%d is not a leap year", yr); 
    getch(); 
}




OUTPUT:





Please have a look at the below video lesson posted on my YouTube channel:


No comments:

Post a Comment