There are many questions and answers about decimal and integer extraction from floating point numbers and getting output for some specific decimal points. But no one could solve my problem. Please, if someone can help me solve my problem-
I actually tried to extract the exact fractional part from the floating point number. I tried with this:
float f=254.73;
int integer = (int)f;
float fractional = f-integer;
printf ("The fractional part is: %f", fractional);
But conclusion: 0.729996. For this reason, when I did this:
float f=254.73;
int integer = (int)f;
float fractional = f-integer;
int fractional_part_in_integer = ((int)(f*100)%100);
printf ("The value is: %d", fractional_part_in_integer);
72 . 73 254.73. , %.2f printf() . . , 73. , , 254,73, 73 , ?
, .