Decipher Binary Number
Swipe to start coding
So far, so good 😃 Convert binary code to the decimal one. Fill the gaps and follow the algorithm. The result of your manipulations is a specific number in math .
- Create variable
decimal_numberfor storing converted decimal number and assign0to it. - Print the binary number.
- Define the variable
powerand assign0to it. - Define the loop that executes till the
binary numberis0. - Count the remainder of division
binary_numberby10and assign it to the variablelast_digit. - Multiply
last_digitby the2raised to the relevant power. - Add the
resultto thedecimal_number. - Decrease
binary_numberusing integer division by10. - Increase
powerby1. - Print the
decimal number.
Solution
Note
You received one of the Armstrong number: the sum of the cubes of its own digits, let me explain this: 370 = 3^3 + 7^3 + 0^3 = 27 + 343 + 0 = 370
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 7.14
Decipher Binary Number
Glissez pour afficher le menu
Swipe to start coding
So far, so good 😃 Convert binary code to the decimal one. Fill the gaps and follow the algorithm. The result of your manipulations is a specific number in math .
- Create variable
decimal_numberfor storing converted decimal number and assign0to it. - Print the binary number.
- Define the variable
powerand assign0to it. - Define the loop that executes till the
binary numberis0. - Count the remainder of division
binary_numberby10and assign it to the variablelast_digit. - Multiply
last_digitby the2raised to the relevant power. - Add the
resultto thedecimal_number. - Decrease
binary_numberusing integer division by10. - Increase
powerby1. - Print the
decimal number.
Solution
Note
You received one of the Armstrong number: the sum of the cubes of its own digits, let me explain this: 370 = 3^3 + 7^3 + 0^3 = 27 + 343 + 0 = 370
Merci pour vos commentaires !
single