Thank you for visiting Write a function named time calc that does the following Accepts four parameters long time data int hours int minutes int seconds Calculates the total. This page is designed to guide you through key points and clear explanations related to the topic at hand. We aim to make your learning experience smooth, insightful, and informative. Dive in and discover the answers you're looking for!

Write a function named `time_calc` that does the following:

- Accepts four parameters: `long time_data`, `int *hours`, `int *minutes`, `int *seconds`.
- Calculates the total number of hours, minutes, and seconds in `time_data`. Note that `time_data` stores a total number of seconds.
- The results are stored using pointers so that they can be used by the calling program.

Hints:
- Remember that there are 3600 seconds in one hour.
- You can use the remainder (%) operator to separate the number of seconds from the number of whole minutes in a given number of seconds. For example, 75 seconds is 1 minute and 15 seconds.

Answer :

Here is a C function called `time_calc` that meets the specified parameters and performs the required calculations:

```c
#include

void time_calc(long time_data, int *hours, int *minutes, int *seconds) {
*hours = time_data / 3600;
time_data %= 3600;
*minutes = time_data / 60;
*seconds = time_data % 60;
}

int main() {
long time_data = 36675; // Example time_data value
int hours, minutes, seconds;

time_calc(time_data, &hours, &minutes, &seconds);
printf("Hours: %d, Minutes: %d, Seconds: %d\n", hours, minutes, seconds);

return 0;
}
```

This function takes a `time_data` value in seconds and calculates the total hours, minutes, and seconds. It stores the results using pointers, as specified.

The function that performs the following:Accepts four parameters: long time_data, int *hours, int * minutes, int *secondsCalculates the total number of hours, minutes and seconds in time_data. Note that time data stores a total number of seconds.The results are stored using pointers, so the results can be used by the calling program. Hint: Remember that there are 3600 seconds in one (1) hour. You can use the remainder (%) operator to separate the number of seconds from the number of whole minutes in a given number of seconds. e.g. 75 seconds is 1 minute and 15 seconds.The function named time_calc will have to take the long type data parameter and calculate the total number of hours, minutes, and seconds by considering that the time data stores a total number of seconds. The results have to be stored using pointers so that the calling program can use the results. The hints provided in the question are very useful while solving the problem. One should remember that there are 3600 seconds in one hour. The remainder (%) operator is used to separate the number of seconds from the number of whole minutes in a given number of seconds. For example, 75 seconds is 1 minute and 15 seconds.Hence, the solution to the given problem is mentioned below:```#include void time_calc(long time_data, int* hours, int* minutes, int* seconds){*hours = time_data / 3600;time_data = time_data % 3600;*minutes = time_data / 60;*seconds = time_data % 60;}int main() {long time_data = 86400;int hours, minutes, seconds;time_calc(time_data, &hours, &minutes, &seconds);std::cout << "Hours: " << hours << std::endl;std::cout << "Minutes: " << minutes << std::endl;std::cout << "Seconds: " << seconds << std::endl;} ```

learn more about programming here:

https://brainly.com/question/11023419

#SPJ11

Thank you for reading the article Write a function named time calc that does the following Accepts four parameters long time data int hours int minutes int seconds Calculates the total. We hope the information provided is useful and helps you understand this topic better. Feel free to explore more helpful content on our website!

Rewritten by : Jeany