metersToFeet using modf() - Challenge (SOLUTION)

Challenge: In metersToFeetAndInches(), you used floor() and subtraction to break rawFeet into its integer and fractional parts. Change metersToFeetAndInches() to use modf() instead.

[color=#000080]Main.c[/color]

[code]#include <stdio.h>
#include <math.h>

void metersToFeetAndInches(double meters)
{
double initialCalc = meters * 3.28084;
double intFeet;
double fracFoot = modf(initialCalc, &intFeet);
double inches = fracFoot * 12.0;
printf("%.1f meters is equal to %.1f feet and %.2f inches.\n", meters, intFeet, inches);
}

int main(int argc, const char * argv[]) {
double meters = 3.0;
metersToFeetAndInches(meters);
return 0;
}[/code]

[color=#000080]Output[/color]