I’m seeing several different challenge discussions on this, so I thought I’d throw my solution out there. I got the output to read feet = 9, inches = 10.12, which is what it should, but I skipped the whole “void metersToFeetAndInches” part that I saw in others. Should I be including this and writing it that way or does this condensed version make sense?
[code]#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[]) {
//Use modf() instead of floor() and subtraction to convert metersToFeetAndInches()
//Convert meters into feet
double meters = 3.0;
double rawFeet = meters * 3.281;
double feetPart;
double inchesPart;
//Break rawFeet into feet and inches w/ modf()
inchesPart = 12 * modf(rawFeet, &feetPart);
//Find the value of feet + inches
printf(“feet = %.0f, inches = %.2f\n”, feetPart, inchesPart);
}[/code]