Compute the number of digits after '.' in a floating point number.
e.g. if given 3.554 output=3
for 43.000 output=0
e.g. if given 3.554 output=3
for 43.000 output=0
double no = 3.44;
int count = 0;
while(no!=((int)no))
{
count++;
no=no*10;
}
printf("%d",count);
No comments:
Post a Comment