Created
April 1, 2021 19:26
-
-
Save jagdish4501/d8cdcbc3a35474b5adbc0765fcf4e465 to your computer and use it in GitHub Desktop.
Any year is entered through the keyboard, write a program to determine whether the year is leap or not.
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> | |
int main() | |
{ | |
int year; | |
printf("Enter year :"); | |
scanf("%d", &year); | |
if ((year % 4) == 0) | |
{ | |
if ((year % 100) == 0) | |
{ | |
if ((year % 400) == 0) | |
{ | |
printf("year %d is a leap year", year); | |
} | |
else | |
printf("year %d is not a leap year", year); | |
} | |
else | |
printf("year %d is a leap year", year); | |
} | |
else | |
printf("year %d is not a leap year", year); | |
return 0; | |
} | |
---->> 𝙢𝙚𝙩𝙝𝙤𝙙 2 | |
#include <stdio.h> | |
int main() | |
{ | |
int y; | |
printf("Enter year :"); | |
scanf("%d",&y); | |
if((y%4)==0) | |
{ | |
((y%100)==0)?(((y%400)==0)?printf("leap year"):printf(" not leap year")):printf("leap year"); | |
}else | |
printf(" not leap year"); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment