View Code of Problem 81

#include<iostream>
using namespace std;
int main()
{
	int a[2][12]={{31,29,31,30,31,30,31,31,30,31,30,31},
	{31,28,31,30,31,30,31,31,30,31,30,31}};
	
	int y,m,d,flag=1,sum=0;
	cin>>y>>m>>d;
	
	if((y%4==0&&y%100!=0)||(y%400==0)) flag=0;
	
	for(int i=0;i<m-1;i++)
	{
		sum=sum+a[flag][i];
	}
	
	cout<<sum+d<<endl;
}



Double click to view unformatted code.


Back to problem 81