Professional Documents
Culture Documents
CS 100 - Computational Problem Solving: Fall 2017
CS 100 - Computational Problem Solving: Fall 2017
CS 100 - Computational Problem Solving: Fall 2017
Fall 2017
Quiz 6
Name: ___________________________________________
a. Write array function that shifts all elements by one to the left and move
the first element into the last position [7]
Example 1 Example 2
5 36 12 27 2 32 29 28 35 72 31 77 68 95 72 87 74 68 85 35
36 12 27 2 32 29 28 35 72 5 77 68 95 72 87 74 68 85 35 31
}
b. What is wrong with the following loop? Explain two ways of fixing the error.
[3]
int values[10];
for (int i = 1; i <= 10; i++)
{
values[i] = i * i;
}