Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript

#include <conio.h>

char main(void )
{
  char ascii=0;
   long int binary,hexadecimal=0,j=1,rem;
    int decimal=0;


printf("Enter a binary number:
");
scanf("%ld",&binary);

 while(binary!=0)
 {
rem=binary%10;
hexadecimal=hexadecimal+rem*j;
decimal=decimal+rem*j;
ascii=ascii+rem*j;
ascii=hexadecimal,decimal;
j=j*2;
binary=binary/10;
 }

 printf("decimal : %d
hexadecimal value of number = %x
ascii : %c",decimal,hexadecimal,ascii);


 return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JavaScript
ADD COMMENT
Topic
Name
6+8 =