hey im doing this program for school and its about a user entering their height in centimeters and output it as height in feet and inches im getting the problem when getting the remainder of the feet to be changed into inches and the compiler said that i have an invalid % operand and i know it has to do with the remainder of the feet thing but i just dont know how to do it.
Code:
/* This program converts height in centimeters and
displays it into height in centimeters, feet, inches.*/
#include<stdio.h>
const double CENT_FEET=0.033;
const double CENT_INCHES=0.30;
int main(void) {
int cent, centf, centi, centl;
printf("COnvert Height Into Feet & Inches!\n");
printf("Please Enter Your Height In Centimeters: (<=0 to quit\n");
scanf("%d", ¢);
while (cent>0)
{
centf=(int) cent*CENT_FEET;
centi=(int) cent % CENT_FEET*CENT_INCHES;
printf("%d cm= %.2d feet, .2%d inches\n", cent, centf, centi);
printf("Enter Another Height to COntinue: (<=0 to quit)\n");
scanf("%d", ¢);
}
printf("BYE!\n");
return 0;
}
/*----------------------------------------------------------------------*/