C program to convert an binary number to octal
belongs to collection: C programs - Basic C Programs
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
belongs to collection: C programs - Basic C Programs
total answers (1)
C program to convert an binary number to octal - Source code
Program Output
Program Explanation
1. Take a binary number as input and store it in the variable binary_num.
2. Obtain the remainder and quotient of the input number by dividing it by 10.
3. Multiply the obtained remainder with variable j and increment the variable octal_num with this value.
4. Increment the variable j by multiplying it with 2 and override the variable binary_num with the quotient obtained.
5. Repeat the steps 2-4 until the variable binary_num becomes zero.
6. Print the variable octal_num as output.
need an explanation for this answer? contact us directly to get an explanation for this answer