Skip to the task
Layout
Back to classic view

You are looking at lesson 1. Your place is still lesson 2, task 1: Types.

CHECKTask 8 of 21 · step 4: An algorithm as a sequence of statementsRead the error: a missing ;
Read the error: a missing ; in practice/01/

Delete the semicolon after the first printf and click ▶. Which line and column is the error on, and what does GCC suggest?

Details & hint

In the build window you see:

C:/.../practice/01/main.c: In function 'main':
C:/.../practice/01/main.c:4:30: error: expected ';' before 'printf'
    4 |     printf("Hello, world!\n")
      |                              ^
      |                              ;
    5 |     printf("\n");
      |     ~~~~~~

An error line always has the same shape: file:line:column: error: what is wrong.

Stuck? Line 4, column 30, right after the ). GCC shows a ^ and writes ; under it: exactly what is missing. Put the ; back and check that the program works again.

practice 01 main.c Code Diff +6
M · MODIFIED Green = add, blue = change, red mark = removed line.
#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
printf("\n");
printf("Algorithm: the average of grades\n");
printf("1. Add up all the grades.\n");
printf("2. Count how many grades there are.\n");
printf("3. Divide the sum by the count.\n");
printf("4. Print the answer.\n");
return 0;
}