Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript

#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;
}
Source by einjojo.de #
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
8+1 =