厘米换算英尺英寸

 1 #include<stdio.h>
 2 
 3 int main(void)
 4 {
 5     int cm = 0;
 6     int foot = 0;
 7     int inch = 0;
 8 
 9     scanf_s("%d", &cm);
10 
11     foot = (int)(cm / 100.0 / 0.3048);
12     inch = (int)((cm / 100.0 / 0.3048 - foot) * 12);
13 
14     printf("%d %d
", foot, inch);
15 
16     return 0;
17 }

从浮点数中分离出整数部分和小数部分。

原文地址:https://www.cnblogs.com/2018jason/p/11775355.html