💩

programierds

Tests
C Beginner 5 min

Ordering: walking through an array in C

Build a C program that iterates over an array of 5 integers and prints each index with its value.

lines

9

This test asks you to reconstruct one of the most important programs when learning arrays: the walk-through. If you do not understand how to walk through, you cannot sum, search or process anything.

The structure is always the same:

  1. Include <stdio.h> for printf.
  2. Open main.
  3. Declare the array with its values.
  4. Declare the counter i.
  5. A for that goes from 0 to size - 1.
  6. Use numbers[i] inside the loop.
  7. Return 0.

Drag the lines until you have the program. You have a time limit.

Tiempo estimado

05:00:00

Lineas: 9

C Ordenar codigo Beginner 5 min 9 lineas

Ordering: walking through an array in C

Build a C program that iterates over an array of 5 integers and prints each index with its value.

Algoritmo a ordenar

Order the lines to iterate over an array of 5 integers and print each index with its value using a for loop.

Arrastra las lineas o usa los botones de flecha para reordenarlas. Cuando creas que estan en el orden correcto, tocas Verificar ordenamiento.

Lineas mezcladas c
  1. 1
    #include <stdio.h>
  2. 2
    int main() {
  3. 3
        int numbers[5] = {10, 20, 30, 40, 50};
  4. 4
        int i;
  5. 5
        for (i = 0; i < 5; i = i + 1) {
  6. 6
            printf("Index %d -> %d\n", i, numbers[i]);
  7. 7
        }
  8. 8
        return 0;
  9. 9
    }

Ordena todas las lineas y despues toca Verificar ordenamiento.