You are first reading into nums
array which is of type int
. Change that to float
.
nums[k][j++]=atof(num);
atof
returns float
which is rounded down to int
.
------EDIT-----------
printf("%1.0f ", m[i][j]);
This is reason why it prints wrong now. Check it.