F How to write a program in C that will calculate the given year Leap Year or not ? | CodeTheta

How to write a program in C that will calculate the given year Leap Year or not ?

January 18, 2014

/* http://native-code.blogspot.com */
#include<stdio.h>
#include<conio.h>
void main()
{
int y;
int s;
int k;
printf("/* http://native-code.blogspot.com */\n\n enter year: ");
scanf("%d",&y);

if(y%100==0 )

{
 if(y%400==0)
 {
 printf("\n leap year");
 }
 else
 {
  printf("not a leap year\n");
 }

 }

 else
 {

if (y%4==0)
{

 printf("leap year ");
}
else
{
 printf("\n Not a leap year");
}
}
getch();
}
/* http://native-code.blogspot.com */

Post a Comment