2 things, i dont understand the use of centf=(int)(cent*FEET_PER_CENTIMETER);
the (int) here?
and in a little more complicated manner, this is what i did,
#include<stdio.h>
#define cent_feet 0.0333
#define cent_inch 0.4
#include<conio.h>
#include<math.h>
void main()
{
double cent,c1,c2,centft,cms,centit;
int centf,centi,centii;
clrscr();
printf("Enter your height in Cms\n");
scanf("%lf",¢);
centf=cent*cent_feet;
centft=cent*cent_feet;
c1=centft/cent_feet; //to get the remaining in inches
c2=centf/cent_feet;
centi=(c1-c2)*cent_inch;
centii=cent*cent_inch; //gettin the remainder for centimeters
centit=cent*cent_inch;
c1=centit/cent_inch;
c2=centii/cent_inch;
cms=(c1-c2);
printf("%d Feet\n%d inches\n%2.2lf cms",centf,centi,cms);
getch();
}
/*-----------------------------------
output
Enter your height in Cms
172
5 Feet
8 inches
2.00 cms
----------------------------*/