/* output values from a 2D array to a file */ #include int main() { int i, j; float values[3][4] = {{28.5, 46.3, 57.9, 72.6}, {14.3, 15.7, 31.4, 19.4}, {48.9, 13.9, 90.6, 57.8}}; FILE *fptr; fptr = fopen("04_output.txt", "w"); /* print out the values */ for (i=0; i<3; i++) { for (j=0; j<4; j++) { fprintf(fptr, "%4.2f ", values[i][j]); } fprintf(fptr, "\n"); } fclose(fptr); }