Write C statements to accomplish each of the following tasks. Assume these statements will be executed in the order shown. Declare an array named x that can hold 100 double values. Do not initialize the values. Set the value of the first element of the array x to NUM (assuming NUM is a symbolic constant defined above your code). Write a for loop that sets each remaining value of x to the value of the preceding element plus 0.1 (e.g., second element is first + 0.1). Print the value of the last element of x.
Explanation / Answer
#include #define NUM 5 int main(){ double x[100]; //first part int i; x[0]=NUM; //second part printf("Array's first element is: %.3f ",x[0]); for( i=1;i