Write a function to convert a decimal number to its binary representation.
HardProblem Statement
Write a function to convert a decimal number to its binary representation.
Sample Input
A hardcoded number, e.g., 10.
Sample Output
Binary representation of 10 is: 1010
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
fun decimalToBinary(number: Int): String {
// Add your code here to convert to binary
}
fun main() {
val number = 10
println("Binary representation of $number is: ${decimalToBinary(number)}")
}
Input
A hardcoded number, e.g., 10.
Expected Output
Binary representation of 10 is: 1010