Your question is extremely deceptive since you've invented data that you didn't actually use. Your actual data file is more like this:
Code:
1 2 3 4 5 6
2 ...
3 ...
4 ...
5 ...
6 ...
I.e., it has the same values going down the first column as are in the first row.
Your program is simply reading the first value from each row, as per your fscanf format.
If you want to read the first three, try:
Code:
for (i = 0; i < 3; i++)
fscanf(arr, "%f%f%f%*[^\n]%*c", &k[i][0], &k[i][1], &k[i][2]);
Or
Code:
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
fscanf(arr, "%f", &k[i][j]);
}
fscanf(arr, "%*[^\n]%*c");
}