C program of leap year.

C program for leap year.


C program for leap year.This program will check whether given year is leap year or not.


https://programminghub1999.blogspot.com/2018/12/c-program-of-leap-year.html


 Following method has used inside program

  1. Take input from user.
  2. Divide it by 400 if it get divided then it is leap year.
  3. Again divide it by 100 if it get divided then it is not leap year.
  4. After that divide it by 4 if it get divided then it is leap year.
  5. If all the above condition has failed then it is not leap year.


C program for leap year

#include<stdio.h>
#include<conio.h>
void main()
{
   clrscr();

   int year;
   printf("Enter year\n");
   scanf("%d",&year);
   if(year%400==0)
      printf("It is leap year\n");
  else
      if(year%100==0)
      printf("It is not leap year\n");
 else
     if(year%4==0)
     printf("It is leap year\n");
 else
     printf("It is not leap year\n");
     getch();
}


This program will print whether enter year is leap year or    not.

    




C program of leap year. C program of leap year. Reviewed by Deepak kumar soni on December 30, 2018 Rating: 5

No comments:

Powered by Blogger.