➽ Program:-

#include<stdio.h>

int main()

{     

    int binary_number, octal_number = 0, i = 1, rem;

    printf("Enter the Binary Number: ");

    scanf("%d", &binary_number);

   

    while(binary_number != 0)

    {

        rem = binary_number % 10;

        octal_number += rem * i;

        i = i * 2;

        binary_number = binary_number / 10;

    }

   

    printf("Octal Value is %o", octal_number);

    return 0;

}

➽ Output:-

Enter the Binary Number: 11100
Octal Value is 34