View Code of Problem 81

#include <stdio.h>
using namespace std;
typedef struct data{
	int year;
	int month;
	int day;
};
int main(){
	int arr[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
	int a,b,c;
	scanf("%d%d%d", &a,&b,&c);
	if( a%4==0 && a%100 != 0 || a%400 == 0 ){
		arr[1]= 29;
	}else{
		arr[1] = 28;
	}
	int sum = 0;
	for( int i=0; i<b-1; i++ ){
		sum += arr[i];
	}
	printf("%d", sum+c );

	return 0;
	
}

Double click to view unformatted code.


Back to problem 81