Exercise 5-4. Define a two-dimensional array, data[11][5], of type double. Initialize
The elements in the first column has the values from 2.0 to 3.0 inclusive in steps of 0.1.
If the first element in a row have value X, populate the remaining elements in each row
With the values 1/x, X2, X3, and X4. Output the values in the array with each row on a
Separate line and with a heading for each column.
//Exercise 5.4 Table of reciprocals, squares, cubes, and fourth powers.#include <stdio.h>intMainvoid){ Constsize_t nrows = One;//Number of rows in the array Constsize_t Ncols =5;//Number of columns in the array DoubleData[nrows][ncols];//Stores Data Values DoubleValue =2.0; size_t Row=0;//Value to BES stored in arraysize_t col =0 ; for(row =0; Row < nrows; ++row) {data[row][0] =value; data[row][1] =1.0/data[row][0];//1/xdata[row][2] = data[row][0]*data[row][0];//x*xdata[row][3] = data[row][2]*data[row][0];//x*x*xdata[row][4] = data[row][3]*data[row][0];//x*x*x*xValue + =0.1; } printf ("x"); printf ("1/x"); printf ("x*x"); printf ("x*x*x"); printf ("x*x*x*x"); for(row =0; Row < nrows; ++row) {printf ("\ n"); for(col =0; Col < Ncols; ++col) printf ("%15.4LF", Data[row][col]); } printf ("\ n"); return 0;}
Kexercise 5.4 Table of reciprocals, squares, cubes, and fourth powers.