Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program C homework The functions should accept data from main, calculate and return the result to main . Getting data from the user and printing

program C homework

The functions should accept data from main, calculate and return the result to main . Getting data from the user and printing the results should be done in main. When completed, the main function should get input data from the user, call the functions, receive the results of the function calls, and print their results to screen.

1. Write a function that determines the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1, 1994, is day 1. December 31, 1993, is day 365. December 31, 1996, is day 366, since 1996 is a leap year. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year only if it is divisible by 400. Your function should accept the month, day, and year as integers from main as arguments. Include an additional function leap that returns 1 if called with a leap year, 0 otherwise. Sample screen output: CALCULATE DAY OF YEAR Enter a date: 12 31 2004 12/31/2004 is the 366th day of 2004 Note that a leap year is a year that is divisible by 4 but not by 100 or divisible by 400. 1900 was not a leap year because it's divisible by 4 but is also divisible by 100. 2000 was a leap year because it's divisible by 400. 1904 was a leap year because it's divisible by 4 but not divisible by 100.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

=+ Why do you think it is the preferred mode? How successful is it?

Answered: 1 week ago