编写C语言程序,实现如下的单位换算:自己的体重相当于多少磅、多少盎司;自己的身高相当于多少英寸、多少英尺。已知1kg=2.205磅,1kg=35.274盎司,1cm=0.394英寸,1英尺=12英寸。
时间: 2024-05-07 13:15:55 浏览: 250
```c
#include <stdio.h>
int main()
{
float weight, height;
printf("请输入您的体重(kg):");
scanf("%f", &weight);
printf("请输入您的身高(cm):");
scanf("%f", &height);
float pounds = weight * 2.205;
float ounces = weight * 35.274;
float inches = height * 0.394;
float feet = inches / 12;
printf("您的体重相当于 %.2f 磅或 %.2f 盎司。\n", pounds, ounces);
printf("您的身高相当于 %.2f 英寸或 %.2f 英尺。\n", inches, feet);
return 0;
}
```
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044736.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)