Last active
August 18, 2017 00:26
-
-
Save TanjinAlam/bb84ad5b4d5d6cdcc341df5cc2dc7574 to your computer and use it in GitHub Desktop.
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<string.h> | |
struct cl | |
{ | |
int day, month, year; | |
}; | |
struct cl date; | |
void input() | |
{ | |
scanf("%d %d %d", &date.day, &date.month, &date.year); | |
} | |
void main() | |
{ | |
char months[12][10] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; | |
input(); | |
if(date.day<=30) | |
{ | |
if(date.month==2 && date.day==29) | |
{ | |
if((date.year%400==0)||(date.year%100!=0 && date.year%4==0)) | |
{ | |
printf("%s %d, %d", months[date.month-1], date.day, date.year); | |
} | |
else | |
{ | |
printf("%d, %d, %d-%d is not leap year", date.day, date.month, date.year, date.year); | |
} | |
} | |
else | |
printf("%s %d, %d", months[date.month-1], date.day, date.year); | |
} | |
else if(date.day==31 && (date.month==1 || date.month==3 || date.month==5 || date.month==7 || date.month==8 || date.month==10 || date.month==12)) | |
printf("%s %d, %d", months[date.month-1], date.day, date.year); | |
else | |
printf("%d, %d, %d-%s has only 30 days", date.day, date.month, date.year, months[date.month-1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment