c語言練習代碼
發布時間: 2023-09-25 20:14:16
#include
"stdio.h"
main()
{
double
a=0,b;
int
i;
for(i=1;;i++)
{
printf("Enter
a
number:");
scanf("%lf",&b);
if(b>a)
a=b;
if(b<=0)
break;
}
if(a>=0)
printf("%lf\n",a);
}
經驗證,float數據不夠精確,如輸入100.62,輸出的卻是如100.620003。所以用了更精確的double數據。希望能幫到你。
熱點內容