View Code of Problem 81

//ave = (Student[i].score[1] + Student[i].score[2] + Student[i].[3]) / 3;
#include<stdio.h>
struct date
{
	int year;
	int month;
	int day;
 } ;
 int main()
 {
 	struct date Date;
 int t,sum ,i;
 	
 	int a[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
 	int b[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
 	scanf("%d%d%d",&Date.year,&Date.month,&Date.day);
 	t = Date.year;
 	if(t % 4 == 0 && t % 100 != 0 || t % 400 == 0)
 	{
 		
 		for(i = 0,sum = Date.day;i < Date.month - 1;i++)
 		{
 			
 			sum += b[i];
		 }
	 }
	 else
	 
	 	for(i = 0,sum = Date.day;i < Date.month - 1;i++)
 		{
 			
 			sum += a[i] ;
		 }
 	printf("%d",sum);
 }

Double click to view unformatted code.


Back to problem 81