#include<stdio.h> int main(){ long int binaryNumber,octalNumber=0,j=1,remainder; printf("Enter any number any binary number: "); scanf("%ld",&binaryNumber); while(binaryNumber!=0){ remainder=binaryNumber%10; octalNumber=octalNumber+remainder*j; j=j*2; binaryNumber=binaryNumber/10; } printf("Equivalent octal value: %lo",octalNumber); return 0; }
Filled Under
C
C program to convert binary to octal
Related:

C code for product of two binary numbers

C code for sum of two binary numbers:

How to convert large binary number to hexadecimal

C code for binary to decimal conversion

C code for how to convert large binary to octal

C program for hexadecimal to binary conversion

C program to change octal to decimal

C code to convert octal number to decimal number
Subscribe to:
Post Comments (Atom)