📜  javascript - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:23.380000             🧑  作者: Mango

代码示例10
#include
#include

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


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

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