Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a code for this programming c 1. Write a function that determines the day number (1 to 366) in a year for a date

image text in transcribed

write a code for this programming c

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, o 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

Step: 3

blur-text-image

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

Students also viewed these Databases questions

Question

What is the hybridization of phosphorous

Answered: 1 week ago