Skip to content
Dr Jack HW Helper
Home
Browse
About
Contact
Academic Integrity
T
Academic Integrity:
tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.
Home
Browse
W
Write a function day_of_year(month, day, year) that returns the day of the year
Write a function day_of_year(month, day, year) that returns the day of the year
ID:
3641698
• Letter:
W
Question
Write a function day_of_year(month, day, year) that returns the day of the year (an integer between 1 and 366) specified by the three augments.
Explanation / Answer
int day_of_year(int year, int month, int day) { int i, leap; if (year < 1752 || month < 1 || month > 12 || day < 1) return -1; leap = (year%4 == 0 && year%100 != 0) || year%400 == 0; if (day > daytab[leap][month]) return -1; for (i = 1; i 366) || (!leap && yearday > 365)) return -1; for (i = 1; yearday > daytab[leap][i]; i++) yearday -= daytab[leap][i]; *pmonth = i; *pday = yearday; return 0; } /* main: test day_of_year and month_day */ int main(void) { int year, month, day, yearday; for (year = 1970; year
Related Questions
Write a function called timesTen that returns back to the caller the value passe
Question #3536438
Write a function called treeTop that prints the top of a tree. It should take no
Question #3595712
Write a function called va1 that takes as input an integer array g1 and its leng
Question #3599555
Write a function called winmax that receives a vector of real numbers as the fir
Question #3918518
Write a function called year2016 that returns a row-vector of struct-s whose ele
Question #3847139
Write a function called ‘ ReplaceLetterWithAsterisk’ that takes two arguments as
Question #3589044
Write a function called, revense(), to return a copy of the input string but wit
Question #3694983
Write a function called: def bars(pic): which makes every 20 th column and row i
Question #3550097
Navigate
Browse (All)
Browse W
Subjects
Previous
Write a function dayNumber that returns the day number of the year (1 to 366) in
Next
Write a function day_of_year(month, day, year) that returns the day of the year