Octal to binary program in c is program to convert binary to octal in c.
In this tutorial we are going to see what is Binary number, What is octal numbers, how to convert octal to binary, c program to convert octal to binary.
What is binary number
A number expressed in base 2 represented in 0 and 1 are binary numbers.
What is octal numbers
A number expressed in base 8. The numbers from 0 to 7 are octal numbers.
How to convert octal to binary
we convert octal to octal to binary
Octal to decimal conversion : write down the powers of eight start from right to left. Calculate power of 8 for each digit. Write down the final value of each power of eight. Add the final values. This final result is our decimal number.
octal to decimal formula :
Decimal number = Add the power of 8 for each digits in octal number.
Decimal to binary conversion : we divide the decimal number by 2 continually which gives reminder either 0 or 1 or until final result is 0.
Decimal to binary formula :
Simply divide binary number by 2 and write down reminder o or 1 which is out binary number.
Concept you need to know from c
1. While loop in c
2. Assignment and arithmetic operator in c
3. Functions in c
Octal to binary algorithm
2. Declare variable
3. Convert octal to decimal.
4. Next convert Decimal to binary.
5. print binary number.
Octal to binary program in c
printf("Enter Octal Number\n");
printf("Binary Number for given Octal Number %d is %d\n",octal,binary);
int ConvertFromDecimalToOther(int decimal,int num)
int ConvertFromOctaltoDecimal(int octal)
1. Write header files.
2. Write main function.
3. Write a function to convert octal to decimal
4. now convert decimal number to binary number.
5. Print binary number for given octal number.