View Code of Problem 81

#include<stdio.h>
typedef struct data{
	int y;
	int m;
	int d;
}str1;
int main()
{
	struct data str1;
	int t=0,i;
	int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d", &str1.y, &str1.m, &str1.d);
	for(i=0;i<str1.m;i++)
	{
		t = t+a[i]; 
	} 
	t = t + str1.d;
	if(((str1.y%4==0&&str1.y%100!=0)||(str1.y%400==0))&&str1.m>2)
	{
		t = t + 1;
	}
	printf("%d", t);
	return 0; 
}

Double click to view unformatted code.


Back to problem 81