#include<stdio.h>
#include<conio.h>
void main()
{
long int binary,decimal,hexadecimal=0,j=1,rem;
printf("Enter a binary number:
");
scanf("%ld",&binary);
while(binary!=0)
{
rem=binary%10;
decimal=decimal+rem*j;
hexadecimal=hexadecimal+rem*j;
j=j*2;
binary=binary/10;
}
printf("Decimal value of number = %ld
Hexadecimal value of numbre = %X",decimal,hexadecimal);
return 0;
}