gpt4 book ai didi

c - 为什么这个程序一直显示结果?

转载 作者:太空宇宙 更新时间:2023-11-04 07:31:16 27 4
gpt4 key购买 nike

<分区>

我编写了这个程序,它将输入的高度(以厘米为单位)更改为英尺和英寸。当我运行它时,结果不停地出现。有谁知道为什么?

#include <stdio.h>

int main (void)
{
float heightcm;
float feet;
float inch;

printf("Enter height in centimeters to convert \n");
scanf("%f", &heightcm);

while (heightcm > 0)
{
feet = heightcm*0.033;
inch = heightcm*0.394;

printf("\n %0.1f cm = %0.2f feet and %0.2f inches \n", heightcm,feet,inch);
}
return 0;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com