192k views
5 votes
Declare an array named tax rates of five elements of type double and initialize the elements (starting with the first) to the values 0.10, 0.15, 0.21, 0.28, 0.31, respectively.

User Inkling
by
5.0k points

1 Answer

5 votes

Answer:

"double tax_rates[5]= {0.10, 0.15, 0.21, 0.28, 0.31};" is the correct answer for the above question.

Step-by-step explanation:

  • An array is a user-defined data type that is used to define the multiple variables of a single type in a continuous storage location.
  • In the C-programming language, When the user wants to declare an array he needs to define with the help of data type and size of the array with the help of the following syntax-- "Data_type variable_name [size_of_the_array];".
  • When the user wants to initialize the static value in the array then he can do that by the help of following syntax: "Data_type variable_name [size_of_the_array]={first_value,second_value,....,last_value};
  • The above question asked to defined the array of tax_rates name of type double with the above-defined value then he can do that with the help of above-defined syntax (which is defined in the answer part).
User Jdelange
by
3.3k points