Question: Answer the questions below in a typed document. Print this page and the answers page and bring it to the lab. The prelab has to
Answer the questions below in a typed document. Print this page and the answers page and bring it to the lab. The prelab has to be submitted by the end of the class to receive credit. Late submission is not accepted. Pre -lab questions Answer the following question with C language. Write a declaration statement for an array with 10 elements. Assume that the array is going to contain double-precision floating-point temperature data in units of Kelvins. Initialize the array with values of 0 in all elements. 1) Write the same declaration for the temperature data, but for the array has n elements, where n is a pre-declared integer variable (In other words, has already been declared in advance.) Do not give the array initial values in this case. (You cannot initialize variable-length arrays in a declaration statement 2) 3) Using the temperature array declared on number 2, write a 'for loop' that will run a total of n times, and in each iteration will set one of the elements of your temperature array to zero. (Remember that arrays in C go from subscript (0) to (n-1) 4) Using the temperature array declared on number 2, write a 'for loop' that will run a total of n times, and in each iteration will ask the user for an input value and will store it in as each element of your temperature array. It should also feature a statement that adds the new element to a running sum which is stored in a separate variable called T_sum. Write a statement that print a value of temperature data from a known subscript. The subscript is input from user. Assume the input subscript is stored in a previously declared integer type variable "sub 5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
