View Code of Problem 81

#include<stdio.h>
struct data{
	int y;
	int m;
	int d;
};
main(){
	struct data t;
	int i,n=0;
	int a[13]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&t.y,&t.m,&t.d);
	for(i=1;i<t.m;i++)
		n=a[i]+n;
	n=n+t.d;
	if((t.y%400==0)||(t.y%4==0&&t.y%100!=0)&&t.m>2)
		n=n+1;
	printf("%d",n);
}

Double click to view unformatted code.


Back to problem 81