View Code of Problem 81

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,sum=0;
	scanf("%d %d %d",&a,&b,&c);
	int yun[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int nyun[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	if((a%4==0&&a%100!=0)||a%400==0){
		for(int i=0;i<b-1;i++){
			sum=sum+yun[i];
		}
		cout<<sum+c;
	}
	else{
		for(int i=0;i<b-1;i++){
			sum=sum+nyun[i];
		}
		cout<<sum+c;
	}
}

Double click to view unformatted code.


Back to problem 81