1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Inessa [10]
3 years ago
5

Write a function named days() that determines the number of days since January 1, 1900 for any data passed as a structure. Use t

he Date structurestruct Date{int month;int day;int year;};In writing the days() function, use the convention that all years have 360 days and each month consists of 30 days. The function should return the number of days for any Date structure passed to it. Write a main () function to test your function.
Computers and Technology
1 answer:
Lisa [10]3 years ago
3 0

Explanation:

#include <stdio.h>

#include <stdlib.h>

struct date

{

int month;

int day;

int year;

};

int days(struct date *d)

{

int daysTotal;

// Adding days from date::day

if (d->day > 0 && d->day < 31) // Only execute if day is valid

{

daysTotal = d->day - 1;

}// Adding days from date::month

if (d->month > 0 && d->month < 13) // Only execute if month is valid

{

daysTotal += 30 * (d->month-1);

}// Adding days from date::year

if (d->year > 1899) // Only execute if year is valid

{

daysTotal += 360 * (d->year-1900); // subtracting 1900 years

}

return daysTotal; // This may still be a negative value, but is accepted here for simplicity

}

int main()

{

struct date myDate;

printf("Enter a Month: ");

scanf("%d", &myDate.month);

printf("Enter a Day: ");

scanf("%d", &myDate.day);

printf("Enter a Year: ");

scanf("%d", &myDate.year);

printf("the date you entered = %d days", days(&myDate));

return 0;

}

You might be interested in
Which of the following is an object-oriented programming language?
Svetradugi [14.3K]

Explanation:

This is the correct answer

<h3>python</h3>
7 0
2 years ago
Write a program to find the sum of given series: (a) S = 1 + (1/2) + (1/3) + ...... + (1/20)
Snowcat [4.5K]

total = 0

numerator = 1

denominator = 1

while denominator != 20:

   total += numerator/denominator

   denominator+=1

print(total)

I wrote my code in python 3.8. I hope this helps.

3 0
3 years ago
Write technical term of following statements: a.The set of programs to perform specific task. b.A feature of computer which tell
ExtremeBDS [4]

Answer:

a) Application software

d) Lady Augusta Ada Lovelace

b) (it may be versatility

6 0
3 years ago
Using PowerPoint or impress guarantees that your presentation will do which of the following
Molodets [167]
It will show a power point on the files or what u make depending on what u are doing.
4 0
3 years ago
Read 2 more answers
Naomi is giving a presentation on historical figures. She has all the pictures of the people she wants to talk about. After each
kykrilka [37]
The answer would be A. The most efficient way is putting all the pictures on the presentation first and then just put a new text box after each picture and then just repeat the process for all the pictures. 
4 0
3 years ago
Other questions:
  • You can advance slides during a slideshow by pressing the page down key
    7·1 answer
  • #In chemistry, the ideal gas law states:
    5·1 answer
  • What is the name of the malware included in CCleaner?
    11·1 answer
  • How to change default search engine in internet explorer 11?
    13·1 answer
  • How can rows be added to a table​
    5·1 answer
  • Steps in the systems development life cycle​
    15·2 answers
  • The problem analysis phase typically includes which of the following tasks? (Points : 2) Negotiate baseline scope.
    10·1 answer
  • when you enter a formula in a cell the result of the calculation displays in a cell. how do views of formula after entering it?
    9·2 answers
  • Which footing supports a long brick or concrete wall<br>​
    14·1 answer
  • True or false, USBs are slower than RAM.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!