So, in this exercise I need to put the day, month and year and I need to receive what is the number of that day in that year.
Example:
Sample Input
7 02 2008
Sample Output
38
I started with:
int order_of_year(int day, int month, int year)
{
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
return 31;
else if (month == 4 || month == 6 || month == 9 || month == 11 )
return 30;
else // month == 2
if( (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
return 29;
else
return 28;
?
? ( maybe a "for cicle?") ??
?
}
int main(void)
{
int day, month, year;
scanf("%d %d %d", &day, &month, &year);
printf("%d\n", order_of_year(???, probably i ?);
return 0;
}
That's all I could do! Now I'm really struggling because I think I need to use a for cicle, but I don't know how to make it right!