Created
August 15, 2019 22:58
-
-
Save saiedabbas93/027f95d08c7303e3eb064d44bfd04411 to your computer and use it in GitHub Desktop.
Leap_year.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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