0
0
Cprogramming~10 mins

Continue statement - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to skip the current loop iteration when i equals 3.

C
for(int i = 0; i < 5; i++) {
    if(i == [1]) {
        continue;
    }
    printf("%d ", i);
}
Drag options to blanks, or click blank then click option'
A3
B5
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a value other than 3 in the if condition.
Forgetting to use continue inside the if block.
2fill in blank
medium

Complete the code to skip printing even numbers using continue.

C
for(int i = 1; i <= 5; i++) {
    if(i % [1] == 0) {
        continue;
    }
    printf("%d ", i);
}
Drag options to blanks, or click blank then click option'
A2
B3
C5
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong divisor in the modulus operation.
Not using continue to skip the iteration.
3fill in blank
hard

Fix the error in the code to correctly skip printing negative numbers.

C
int numbers[] = {1, -2, 3, -4, 5};
for(int i = 0; i < 5; i++) {
    if(numbers[i] [1] 0) {
        continue;
    }
    printf("%d ", numbers[i]);
}
Drag options to blanks, or click blank then click option'
A!=
B>
C<
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < in the condition.
Using == or != which do not check negativity.
4fill in blank
hard

Fill both blanks to skip printing numbers divisible by 3 or less than 0.

C
int arr[] = {3, -1, 4, 6, -5};
for(int i = 0; i < 5; i++) {
    if(arr[i] [1] 0 || arr[i] % [2] == 0) {
        continue;
    }
    printf("%d ", arr[i]);
}
Drag options to blanks, or click blank then click option'
A<
B>
C3
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < for negative check.
Using wrong divisor in modulus operation.
5fill in blank
hard

Fill all three blanks to skip printing numbers that are negative, divisible by 2, or equal to 7.

C
int nums[] = {7, -2, 4, 9, -5};
for(int i = 0; i < 5; i++) {
    if(nums[i] [1] 0 || nums[i] % [2] == 0 || nums[i] [3] 7) {
        continue;
    }
    printf("%d ", nums[i]);
}
Drag options to blanks, or click blank then click option'
A<
B2
C==
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < for negative check.
Using wrong divisor or operator for equality check.