-->

Facebook

Jasper Roberts - Blog

Monday, September 29, 2014

welcome to mech - b class in c for all

welcome to mech - b class in c for all website for pdf and .docx download

Write a C Program to check entered year is a leap year or not.

DOWNLOADDOWNLOAD

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

void main()
{
  int year;

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

  if(year%4 == 0)
      printf("\n This is a leap year.", year);
 
  else if (year%400 == 0)
      printf("\n This is a leap year.", year);

  else if(year%100 == 0)
      printf("\n This is not a leap year.", year);
 
  else
      printf("\n This is not a leap year.", year); 

  getch();
}

OUTPUT:
 Enter a year: 12
This is a leap year.