I having a problem with converting centimeters to yards, feet and inches. I can get the first test variable(312cm) to come close to the output that it's suppose to be but 'm always off by an inch. I tried my next variable of 300cm and I started getting negative numbers. please help, where did I mess up?
Put the code you need help with here.
totalinches = (cent) / CENT_PER_IN;
yd = totalinches / IN_PER_YD;
int remaining = totalinches - yd*36;
ft = remaining / IN_PER_FT;
in = remaining - ft*12;
I'm pretty sure this is right, but I'd check it if I were you. Also, you could combine equations to remove the remaining variable, but I thought it would show what was happening better with remaining included.