#include stdiohmainint in; float h; coust float b=13; fori=1;i46;i++; scanff&h; fori=1;i46;i++ ifhb printffh; n++; printfdn;运行程序
该程序存在语法错误,在第四行应该是 "const" 而不是 "coust"。并且第一段 for 循环是无意义的,应该将其删除。
修改后的代码如下:
#include "stdio.h" int main(){ int i, n = 0; float h; const float b = 1.3; for(i = 1; i < 46; i++){ scanf("%f", &h); if(h < b){ printf("%f", h); n++; } } printf("%d", n); return 0; }
该程序的功能是输入一串浮点数,如果输入的数小于 1.3,则输出该数,并统计小于 1.3 的数的个数。
原文地址: http://www.cveoy.top/t/topic/eDyp 著作权归作者所有。请勿转载和采集!