63 063
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #3168 in C++ for fmm

Question #3168
What will be the values of k[1] and k[3] after execution of the code segment below using the data shown?

int k[6] = {0, 0, 0, 0, 0, 0};
int i, n;

for (i = 3; i < 6; ++i) {
scanf("%d", &n);
k[n] = i;
}
Expert's answer
This program asks the user enter three values being the indexes for elements of array k, and assigns to elements with these indexes the values 3, 4, 5 respectively.
So for safity it is necessary to enter numbers from 0 to 5.

Thus the values of k[1] and k[3] depend on indexes which the user enter.
For example
if the user input 0,1,2 then k[1]=4, k[3]=0
if the user input 3,2,4 then k[1]=0, k[3]=3
if the user input 5,0,3 then k[1]=0, k[3]=5

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions