0
0
Cprogramming~10 mins

Arithmetic operators - Interactive Code Practice

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

Complete the code to add two numbers and store the result.

C
int a = 5, b = 3;
int sum = a [1] b;
printf("%d", sum);
Drag options to blanks, or click blank then click option'
A-
B/
C*
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' subtracts instead of adding.
Using '*' multiplies instead of adding.
2fill in blank
medium

Complete the code to find the remainder when dividing two numbers.

C
int x = 10, y = 3;
int remainder = x [1] y;
printf("%d", remainder);
Drag options to blanks, or click blank then click option'
A%
B*
C/
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using '/' gives the quotient, not the remainder.
Using '*' multiplies instead of dividing.
3fill in blank
hard

Fix the error in the code to multiply two numbers correctly.

C
int a = 4, b = 7;
int product = a [1] b;
printf("%d", product);
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' adds instead of multiplying.
Using '/' divides instead of multiplying.
4fill in blank
hard

Fill in the blank to calculate the quotient of two numbers as an integer division.

C
int a = 15, b = 4;
int quotient = a [1] b;
printf("%d", quotient);
Drag options to blanks, or click blank then click option'
A*
B%
C/
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using '%' gives the remainder, not the quotient.
Using '*' multiplies instead of dividing.
5fill in blank
hard

Fill both blanks to compute the expression: (a + b) * c.

C
int a = 2, b = 3, c = 4;
int result = (a [1] b) [2] c;
printf("%d", result);
Drag options to blanks, or click blank then click option'
A+
B-
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' inside parentheses.
Using '/' instead of '*' for multiplication.