i want to extract the decimal part of a float variable by substracting the whole part, the thing is i get a wrong value
#include<stdio.h>
int main(){
    int k ;
    float a=12.36,i;
    k = (int)a;
    i = a - k ;
    i*=10;
    printf("%f",i);
    return 0;
}
well, the output is 3.599997 not 3.6 , is there a way to solve this ? edit : i know it's because of the binary conversion, i m asking if there is a solution to get the right result, not the cause of it. ty for the replies anw. edit 2 : sadly it's not a matter of display, i want the stored value to be 3.6 ( in this case) because i need it in other calculations.
