➽ Program:-

#include<iostream>

#include<math.h>

using namespace std;

 

long OctalToBinary(int octal_number)

{

    int decimal_number = 0, i = 0;

    long binary_number = 0;

 

    while(octal_number != 0)

    {

        decimal_number += (octal_number % 10) * pow(8,i);

        i++;

        octal_number = octal_number / 10;

    }

 

    i = 1;

 

    while(decimal_number != 0)

    {

        binary_number += (decimal_number % 2) * i;

        decimal_number = decimal_number / 2;

        i = i * 10;

    }

 

    return binary_number;

}

 

int main()

{

    int octal_number;

    cout << "Enter an Octal Number: ";

    cin >> octal_number;

 

    cout << "Binary number is " << OctalToBinary(octal_number);

    return 0;

}

➽ Output:-

Enter an Octal Number: 1500
Binary number is 1101000000