This assignment must be be uploaded in a text or PDF file to Homework 6 on moodle by 11:00 PM on 15 October.
Problem 1 and only
Following the rules of the Translating C to C: Control Structures lecture, rewrite a section of properly structured C code into C code that only uses two control structures:
goto label ;if (expression) goto label ;
Also, do not use the ?: operator of C and Java to simulate an
if then else.
This specifically means that you can’t use the
for, while, switch,
or even the statement block delimiters { and }.
You can use the if, but if must be followed by a goto statement as shown above.
Here is the C code to translate.
pairCount = 0 ;
oddCount = 0 ;
for (i=0; i<size; i=i+1) {
if (V[i] == V[i+1]) {
pairCount = pairCount + 1;
} else if (V[i] & 1) {
oddCount = oddCount + 1;
}
}