Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C Write a function call to ConvertTime() to store the number of years, months, and days within the integer variables numYears, numMonths, and

Code in C

Write a function call to ConvertTime() to store the number of years, months, and days within the integer variables numYears, numMonths, and numDays, respectively.

Ex: If the input is 2227, then the output is:

Years: 6

Months: 1

Days: 7

Code:

#include

void ConvertTime(int totalDays, int* numYears, int* numMonths, int* numDays) { *numYears = totalDays / 365; totalDays = totalDays % 365; *numMonths = totalDays / 30; totalDays = totalDays % 30; *numDays = totalDays; }

int main(void) { int totalDays; int numYears; int numMonths; int numDays;

scanf("%d", &totalDays); /* Your code goes here */ printf("Years: %d ", numYears); printf("Months: %d ", numMonths); printf("Days: %d ", numDays); return 0; }

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

Students also viewed these Databases questions

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago