in c
Write a function call to ConvertTime() to store the number ofhours, minutes, and seconds within the integer variables numHours,numMinutes, and numSeconds, respectively.
Ex: If the input is 18108, then the output is:
Hours: 5 Minutes: 1 Seconds: 48
#include <stdio.h>
void ConvertTime(int totalSeconds, int* numHours, int*numMinutes, int* numSeconds) { *numHours = totalSeconds / 3600; totalSeconds = totalSeconds % 3600; *numMinutes = totalSeconds / 60; totalSeconds = totalSeconds % 60; *numSeconds = totalSeconds;}
int main(void) { int totalSeconds; int numHours; int numMinutes; int numSeconds;
scanf("%d", &totalSeconds); /* Your code goes here */ printf("Hours: %d\n", numHours); printf("Minutes: %d\n", numMinutes); printf("Seconds: %d\n", numSeconds); return 0;}
in c Write a function call to ConvertTime() to store the number of hours, minutes, and seconds within the integer variab
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am