Skip to content

Instantly share code, notes, and snippets.

@saiedabbas93
Created August 15, 2019 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saiedabbas93/027f95d08c7303e3eb064d44bfd04411 to your computer and use it in GitHub Desktop.
Save saiedabbas93/027f95d08c7303e3eb064d44bfd04411 to your computer and use it in GitHub Desktop.
Leap_year.c
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
printf("Enter the year\n");
scanf("%d",&year);
if(year%4==0)
{
if (year%100!=0)
{
printf("Its a leap year");
}
else if (year%100==0 && year%400==0)
printf("Its a leap year");
else
printf("Not aleap year");
}
else
printf("Not a leap year");
}
Enter the year
2012
Its a leap year
PS C:\Program code> cd "c:\Program code\" ; if ($?) { gcc tempCodeRunnerFile.c -o tempCodeRunnerFile } ; if ($?) { .\tempCodeRunnerFile }
Enter the year
2000
Its a leap year
PS C:\Program code> cd "c:\Program code\" ; if ($?) { gcc tempCodeRunnerFile.c -o tempCodeRunnerFile } ; if ($?) { .\tempCodeRunnerFile }
Enter the year
1900
Not aleap year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment