View Code of Problem 81

#include <stdio.h>
struct date{
	int year;
	int month;
	int day;
}n;
int ryear(int y){
	int flag=0;
	if(y%400==0||(y%4==0&&y%100!=0))
	{
		flag=1;
	}
	return flag;
}
void main(){
	int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int i,s=0,t;
	scanf("%d%d%d",&n.year,&n.month,&n.day);
	for(i=1;i<n.month;i++){
		s+=d[i];
	}
	t=ryear(n.year);
	s=s+n.day+t;
	printf("%d",s);

}

Double click to view unformatted code.


Back to problem 81