C Program to convert octal to hexadecimal number

Program

#include<math.h>
#include<stdio.h>
void decimal_hexa(int num);
void octal_hexa(int octal) {
    int decimal = 0, i = 0;
    long long binary = 0;
    // convert octal to decimal
    while (octal != 0) {
        decimal += (octal % 10) * pow(8, i);
        ++i;
        octal /= 10;
    }
    i = 1;
   // convert decimal to hexa
   decimal_hexa(decimal);  
}
// Method to convert decimal to hexadecimal
void decimal_hexa(int num)
{    
    int rem;
    int base = 16;  
    long int h = 0;  
    if (num != 0)    
    {
        rem = num % base;         
        decimal_hexa(num/base);             
        if(rem >= 10)    
        {
             printf("%c",rem+55);
        }  
        else
        {
            printf("%d",rem);
        }
    }       
}
int main() {
    int octal;
    printf("Enter an octal number: ");
    scanf("%d", &octal);
    printf("Hexadecimal equivalent is:");
    octal_hexa(octal);
    return 0;
}

Output

$ gcc convert-octal-to-hexa.c -lm
$ ./a.out
Enter an octal number: 345
Hexadecimal equivalent is:E5