View Code of Problem 81

#include<stdio.h>
struct Date{
	int y;
	int m;
	int d;
}date;

int main(void){
	int mh[12]={31,28,31,30,31,30,31,31,30,31,30,31},s;
	scanf("%d %d %d",&date.y,&date.m,&date.d);
	for(int i=0;i<date.m-1;i++){
		s+=mh[i];
	}
	if((date.y%4==0&&date.y%100!=0)||date.y%400==0){
		if(date.m<3){
			printf("%d",s+date.d);
		}else{
			printf("%d",s+date.d+1);
		}
	}else{
		printf("%d",s+date.d);
	}
}

Double click to view unformatted code.


Back to problem 81