把单位为cm的身高转化为英尺(整数)和英寸(整数),为什么这样不行呀?
#include <stdio.h>int main()
{
double a;
double foot;
double inch;
int t1;
int t2;
foot=a/30.48;
t1=foot;
inch=a%30.48*12.0;
t2=inch;
scanf("%f",&a);
printf("foot=%d inch=%d\n",t1,t2);
return 0;
}
#include <stdio.h> int main(void) { int foot, inch; int meter; scanf("%d", &meter); foot = meter / 30.48; inch = (meter - 30.48 * foot) / 30.48 * 12; printf("foot=%d inch=%d\n", foot, inch); return 0; }