Tuesday, 16 June 2015

C program to check leap year.

WAP to check whether the year entered by the user is leap year or not.
Program:
#include<stdio.h>
#include<conio.h>
int main()
{
    int year;    //Declaring Variable.
   
    printf("Enter any year: ");  //For printing
    scanf("%d",&year);  //For Input.

    if(((year%4==0)&&(year%100!=0))||(year%400==0))  //If Statement
         printf("%d is a leap year",year);  //For printing
    else
         printf("%d is not a leap year",year);  //For printing
    getch(); //Getting a character or waiting for key press
 return 0;
}

Output:

Video Explanation
Sorry Guys Explanation of this tutorial will be posted later this month.



No comments:

Post a Comment