C问题关于判断整数和小数的问题
写一个程序段,允许用户输入值并显示出输入的整数值和带小数部分的值的数量。以0作为标记值的标记控制循环我编的有什么问题啊
#include<stdio.h>
int main()
{
double num;
int integer_num = 0,
decimal_num = 0;
scanf("%f", &num);
while(num!=0)
{ scanf("%f", &num);
if(num != (int)num)
{
integer_num=integer_num+1;
decimal_num=decimal_num+1;
}
else
integer_num=integer_num+1;
}
printf("the integer_num is %d\n", integer_num);
printf("the decimal_num is %d\n", decimal_num);
return(0);
}