In C please
Write a function call to ConvertTime() to store the number ofmonths, weeks, and days within the integer variables numMonths,numWeeks, and numDays, respectively.
Ex: If the input is 222, then the output is:
Months: 7 Weeks: 1 Days: 5
#include <stdio.h>
void ConvertTime(int totalDays, int* numMonths, int* numWeeks,int* numDays) { *numMonths = totalDays / 30; totalDays = totalDays % 30; *numWeeks = totalDays / 7; totalDays = totalDays % 7; *numDays = totalDays;}
int main(void) { int totalDays; int numMonths; int numWeeks; int numDays;
scanf("%d", &totalDays); /* Your code goes here */ printf("Months: %d\n", numMonths); printf("Weeks: %d\n", numWeeks); printf("Days: %d\n", numDays); return 0;}
In C please Write a function call to ConvertTime() to store the number of months, weeks, and days within the integer var
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am