Whats up, I got a small problem with an assignment: so I am supposed to convert feet and inches to meters; however, the function i must use must have feet and inches as (int) variables. by doing this the inch units will not be rounded....
any idea how can i fix this using "int"?
Thank you in advance...
Code:
#include <stdio.h>
#include <math.h>
void meters_to_feet_inches(double m, int *ft, int *in);
int main()
{
int feet, inches;
double meters;
printf("enter meters to be converted\n");
scanf("%lf", &meters);
meters_to_feet_inches(meters, &feet, &inches);
printf("meters in inches is = %d feet, %d inches\n", feet, inches);
return 0;
}
void meters_to_feet_inches(double m, int *ft, int *in)
{
double inft, temp;
inft=m*39.37;
*ft=inft/12;
*in=(int)inft%12;
}