well i have this program to write that has to get a user input in centimeters and display it in feet and inches and the problem is that im getting an invvalid % operand ....This is the code.and ill put a [] to show where the problem is. its to get the lrft over feet to be changd into inches.
/* 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;]--->my problem
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;
}
/*----------------------------------------------------------------------*/
thanx if u can hellp
/* 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;]--->my problem
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;
}
/*----------------------------------------------------------------------*/
thanx if u can hellp