0
0
Kotlinprogramming~10 mins

Arithmetic operators in Kotlin - 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 print the result.

Kotlin
val sum = 5 [1] 3
println(sum)
Drag options to blanks, or click blank then click option'
A/
B+
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or multiplication instead of addition.
2fill in blank
medium

Complete the code to multiply two numbers and print the result.

Kotlin
val product = 7 [1] 4
println(product)
Drag options to blanks, or click blank then click option'
A/
B+
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition or division instead of multiplication.
3fill in blank
hard

Fix the error in the code to correctly divide two numbers and print the result.

Kotlin
val result = 10 [1] 2
println(result)
Drag options to blanks, or click blank then click option'
A*
B-
C/
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication or subtraction instead of division.
4fill in blank
hard

Fill both blanks to calculate the remainder of division and print it.

Kotlin
val remainder = 17 [1] 5 [2] 2
println(remainder)
Drag options to blanks, or click blank then click option'
A%
B+
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or multiplication instead of modulo.
Forgetting to add 2 after the modulo operation.
5fill in blank
hard

Fill all three blanks to compute the expression and print the result.

Kotlin
val result = (8 [1] 3) [2] 2 [3] 4
println(result)
Drag options to blanks, or click blank then click option'
A*
B+
C-
D%
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of operations.
Using wrong operators for each step.