made a few changes in calculation Conversion Site . You were initializing leftoverinches
before taking centimenter
input.
below is the updated code -
/*cent_to_feet.c -- converts a user's height in centimetres to feet and inches*/
#include <stdio.h>
#include <math.h>
int main(void)
{
float centimetres;// feet are inches/12, take the leftover and thats the inches
printf("\nWhat is your height in centimetres?\n");
printf("Enter here:_____\b\b\b\b\b");//user enters height in cm
scanf("%f", ¢imetres);//takes user data and denotes it 'cm'
float inches = centimetres/2.54;
int feet=floor(inches/12);
float leftoverinches = inches - 12*feet;
printf("left : %f",leftoverinches);
if (centimetres < 180){
printf("Wow little monkey! I didn't know they made them so short! \nDo you want a cup of milk or a banana to make you feel better? ");
}
else {
printf("Wow thats pretty tall!\n That's %d feet and %f inches", feet, leftoverinches);
}
printf("\nIn any case, you're %d'%.f", feet, leftoverinches);
getchar();
getchar();
return 0;
}