79413784

Date: 2025-02-05 06:01:43
Score: 0.5
Natty:
Report link

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", &centimetres);//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;

}

Reasons:
  • Blacklisted phrase (1): What is your
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ansh Malgotra