90.4k views
1 vote
1- (8 point) The following questions relate to an array called numfrc. a) Define the size of the array to 25 by using a constant macro SIZE. b) Declare the array to be of type double and initialize the elements to 0. c) Assign the value of 6.666 to the 14 th element of the array from beginning. d) Refer to array element index 14 and assign the value of -6.666 to it. e) Assign the value 1.667 to array element index nine. f) Assign the value 3.333 to the seventh element of the array from beginning. g) Print array elements index 14 and 9 with two digits of precision to the right of the decimal point, and show the output that is displayed on the screen. h) Print all the elements of the array, using a for repetition statement. Assume the variable i has been defined as a counter control variable for the loop. Show the output as a table with index number and element value.

User Jon Gold
by
5.3k points

1 Answer

2 votes

Answer:

Step-by-step explanation:

Note: Alphabets refers to respective problem in question

Program:

#include<stdio.h>

#define SIZE 25

int main()

{

double numfrc[SIZE]; // (a)

for(int i=0;i<SIZE;i++) // (b)

numfrc[i]=0;

numfrc[13]=6.666; // (c)

numfrc[14]=-6.666; // (d)

numfrc[9]=1.667; // (e)

numfrc[6]=3.333; // (f)

for(int i=14;i>=9;i--)

printf("%2d ---> %.2lf\\",i,numfrc[i]); // (g)

printf("\\");

for(int i=0;i<SIZE;i++)

printf("%2d ---> %.2lf\\",i,numfrc[i]); // (h)

}

Output:

1- (8 point) The following questions relate to an array called numfrc. a) Define the-example-1
User Pifantastic
by
5.9k points