View Code of Problem 81

#include<stdio.h>
int leap(int n)
{
if(n%400==0||(n%4==0&&n%100!=0))
return 1;
else return 0;
}
int main()
{
int a,b,c,sum,i;
sum=0;
int x[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int y[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
scanf("%d%d%d",&a,&b,&c);
{
if(!leap(a))
{
for(i=0;i<b;i++)
sum+=x[i];
}
else
{
for(i=0;i<b;i++)
sum+=y[i];
}
sum+=c;

}
printf("%d",sum);
return 0;
}

Double click to view unformatted code.


Back to problem 81