Question: C Programming *Notice: I can only edit the part where it says in /* Your solution goes here */ the other part of the code
C Programming
*Notice: I can only edit the part where it says in /* Your solution goes here */ the other part of the code i can't touch it please the solution should be inside that part ad using the code provided
Question 1
Complete the function ConvertToFeetAndInches to convert totalInches to feet and inches. Return feet and inches using the HeightFtIn struct. Ex: 14 inches is 2 feet and 2 inches.
#include
typedef struct HeightFtIn_struct { int feet; int inches; } HeightFtIn;
HeightFtIn ConvertToFeetAndInches(int totalInches) { HeightFtIn tempVal;
/* Your solution goes here */
}
int main(void) { HeightFtIn studentHeight; int totalInches;
scanf("%d", &totalInches); studentHeight = ConvertToFeetAndInches(totalInches); printf("%d feet and %d inches ", studentHeight.feet, studentHeight.inches);
return 0; }
Question2
Complete the function ConvertToWeeksAndDays to convert totalDays to weeks and days. Return weeks and days using the TimeWeekDay struct. Ex: 16 days is 2 weeks and 2 days.
#include
typedef struct TimeWeekDay_struct { int weeks; int days; } TimeWeekDay;
TimeWeekDay ConvertToWeeksAndDays(int totalDays) { TimeWeekDay tempVal;
/* Your solution goes here */
}
int main(void) { TimeWeekDay elapsedDays; int totalDays;
scanf("%d", &totalDays); elapsedDays = ConvertToWeeksAndDays(totalDays); printf("%d weeks and %d days ", elapsedDays.weeks, elapsedDays.days);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
