Can someone tell me why my program does not compile?
__________________________________________________ _
int bitcnt ( float n );
#include<stdio.h>
int main ( void )
{
float n;
for (;
{
printf("Give a positive integer ( <=0 to stop ) : ");
scanf("%f", &n);
if (n <= 0) break;
printf("Number of ones in bit representation of %f : %.2f\n",
n, bitcnt(n));
}
return 0;
}
int bitcnt ( float n )
{
int cnt = 0;
float work;
for (work = n; work > 0; work /= 2)
cnt += (work % 2);
return cnt;
}