Consider the following declarations: const int CAR_TYPES = 5; const int COLOR_TY
ID: 3551653 • Letter: C
Question
Consider the following declarations:const int CAR_TYPES = 5;
const int COLOR_TYPES = 6;
double sales[CAR_TYPES][COLOR_TYPES];
a. How many components does the array sales have?
b. What is the number of rows in the array sales?
c. What is the number of columns in the array sales?
d. To sum the sales by CAR_TYPES, what kind of processing is required?
e. To sum the sales by COLOR_TYPES, what kind of processing is required? Consider the following declarations:
const int CAR_TYPES = 5;
const int COLOR_TYPES = 6;
double sales[CAR_TYPES][COLOR_TYPES];
a. How many components does the array sales have?
b. What is the number of rows in the array sales?
c. What is the number of columns in the array sales?
d. To sum the sales by CAR_TYPES, what kind of processing is required?
e. To sum the sales by COLOR_TYPES, what kind of processing is required? Consider the following declarations:
const int CAR_TYPES = 5;
const int COLOR_TYPES = 6;
double sales[CAR_TYPES][COLOR_TYPES];
a. How many components does the array sales have?
b. What is the number of rows in the array sales?
c. What is the number of columns in the array sales?
d. To sum the sales by CAR_TYPES, what kind of processing is required?
e. To sum the sales by COLOR_TYPES, what kind of processing is required?
Explanation / Answer
row_addition---->
suppose we want to add row no.:i then- the code will be->
------------------------
row_i_sum=0;
for(j=0;j<6;j++)
row_i_sum = row_i_sum + sales[i][j];
-----------------------------
column_addition---->
suppose we want to add column no.:j then- the code will be->
------------------------
column_j_sum=0;
for(i=0;i<5;i++)
column_j_sum = column_j_sum + sales[i][j];
-----------------------------
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.