Math Problem Statement
A network protocol specifies how data is exchanged via transmission media, The protocol converts each message into a stream of 1s and Os. Given a decimal number, write an algonshm to convert the number into a binary form.
Input
The input consists of an integer num, representing the decimal number.
Output Print an integer representing the binary form of the given decimal number. Example
Input: 25
Output: 11001
Explanation:
Divide the given number 25 by 2.
The quotient is 12 and the remainder is 1, the least significant bit.
Now divide the quotient 12 by 2, The quotient is 6 and the remainder is 0.
Similarly, divide the quotient until it becomes zero and store its I want in c# language
Solution
Ask a new question for Free
By Image
Drop file here or Click Here to upload
Math Problem Analysis
Mathematical Concepts
Number Systems
Binary Conversion
Division and Remainders
Formulas
num = num ÷ 2, remainder = num % 2
Theorems
Binary representation using division by 2
Suitable Grade Level
Grades 6-8