0
0
Cprogramming~10 mins

Writing first C program - Interactive Code Practice

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

Complete the code to include the standard input-output header.

C
#include [1]
Drag options to blanks, or click blank then click option'
A<stdlib.h>
B<math.h>
C<stdio.h>
D<string.h>
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong header that doesn't provide printf.
Forgetting the angle brackets around the header name.
2fill in blank
medium

Complete the code to start the main function.

C
int [1]() {
Drag options to blanks, or click blank then click option'
Astart
Brun
Cbegin
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name instead of main.
Omitting the parentheses after the function name.
3fill in blank
hard

Fix the error in the printf statement to print Hello World.

C
printf([1]);
Drag options to blanks, or click blank then click option'
A"Hello World"
B'Hello World'
CHello World
DHello World;
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes which are for single characters.
Not using any quotes causing a syntax error.
4fill in blank
hard

Fill the blank to correctly end the main function with a return statement.

C
    return [1];
}
Drag options to blanks, or click blank then click option'
A1
B0
Cmain
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Returning 1 which usually means an error.
Returning the function name or void which is invalid.
5fill in blank
hard

Fill all three blanks to complete the full Hello World program.

C
#include [1]

int [2]() {
    printf([3]);
    return 0;
}
Drag options to blanks, or click blank then click option'
A<stdio.h>
Bmain
C"Hello World"
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Missing the header include.
Wrong function name or missing parentheses.
Not quoting the string in printf.