View Code of Problem 81

#include <stdio.h>
int main()
{
	int i,year,mon,day,sum=0;
	int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d",&year,&mon,&day);
	for(i=0;i<mon;i++)
	{
		sum=sum+a[i];
	}
	if((year%4==0 && year%100!=0) ||(year%400==0))
	{
		if(mon>2)
		{
			printf("%d",sum+1+day);
		}
		else
		{
			printf("%d",sum+day);
		}
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 81