0
0
C Sharp (C#)programming~10 mins

Arithmetic operators in C Sharp (C#) - 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 Sharp (C#)
int sum = 5 [1] 3;
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 10 by 4.

C Sharp (C#)
int remainder = 10 [1] 4;
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 Sharp (C#)
int product = 7 [1] 6;
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 both blanks to create a dictionary of squares for numbers greater than 3.

C Sharp (C#)
var squares = new Dictionary<int, int> { { [1], [2] } };
Drag options to blanks, or click blank then click option'
A4
B16
C5
D25
Attempts:
3 left
💡 Hint
Common Mistakes
Using a key less than or equal to 3.
Using a value not matching the square of the key.
5fill in blank
hard

Fill all three blanks to create a dictionary of cubes for numbers greater than 1.

C Sharp (C#)
var cubes = new Dictionary<int, int> { { [1], [2] }, { [3], 27 } };
Drag options to blanks, or click blank then click option'
A3
B9
C8
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up keys and values.
Using squares instead of cubes.