➽ Program:-

#include<stdio.h>

int main()

{

    long int binary_number, hexadecimal_number = 0, i = 1, rem;

    printf("Enter the Binary Number: ");

    scanf("%ld", &binary_number);

   

    while(binary_number != 0)

    {

        rem = binary_number % 10;

        hexadecimal_number = hexadecimal_number + rem * i;

        i = i * 2;

        binary_number = binary_number / 10;

    }

   

    printf("Hexadecimal value is %lX", hexadecimal_number);

    return 0;

}

➽ Output:-

Enter the Binary Number: 10101
Hexadecimal value is 15