题目:
如果已知英制长度的英尺foot和英寸inch的值,那么对应的米是(foot+inch/12)×0.3048。现在,如果用户输入的是厘米数,那么对应英制长度的英尺和英寸是多少呢?别忘了1英尺等于12英寸
思路:理解公式:inch/12化为英尺 (foot + inch/12)* 0.3048 代表 (foot + inch/12)英尺有多少米,显然一英尺代表0.3048米,
#include<stdio.h>
int main()
{
float high;
int foot;
int inch;
scanf("%f",&high);
foot = high /(0.3048 * 100);
inch = (high/(0.3048 * 100) - foot) * 12;
printf("%d %d",foot,inch);
return 0;
}