Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int isLeapYear(int x)
- {
- int result;
- if (x%400 ==0)
- {
- result=1;
- }
- else if(x%100==0)
- {
- result = 0;
- }
- else if (x%4 == 0)
- {
- result =1;
- }
- else
- {
- result = 0;
- }
- return result;
- }
- int main()
- {
- int year;
- printf("Enter any year: ");
- scanf("%d", &year);
- if(isLeapYear(year)) {
- printf("%d is leap year!\n", year);
- } else {
- printf("%d is not leap year!\n", year);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment