This is not a perfect program, but it will get you started in the right direction. Works for any INTEGER up to "some" power of 2 (decimals kill the program).
PROGRAM binary
IMPLICIT NONE
INTEGER remainder, quotient, n, int_input, answer
REAL input, dec_input
WRITE(*,*) 'Input a number to convert to binary'
READ(*,*) input
int_input = input
dec_input = input - int_input
dec_input = abs(dec_input)
quotient = abs(input)
DO WHILE (dec_input==0)
n = 0
answer = 0
DO WHILE (quotient>1)
remainder = mod(quotient,2)
quotient = quotient/2
answer = answer+remainder*10.**n
n = n+1
END DO
IF (input<0) answer = -answer
answer = answer + quotient*10.**n
WRITE(*,"(a,i31)") 'Your answer in binary is:',answer
END DO
END PROGRAM binary
hexadecimal, eg. 1ABH = 1AB(16) = 427(10)
Decimal 30 = binary 11110. The decimal binary code (BCD), however, is 11 0000.
The oldest computer language is machine code and all computer languages are binary encoded. It's unavoidable on binary machines.
BAD16: Binary = 10111010110100010110 Decimal = 765206
8 in decimal is 1000 in binary
The decimal equivalent of the binary number 1111111111111111 is 65535.
That is 31 in decimal
10
170
110001.01
13
45
The binary number 1111 = 15
15 = 1111
A flow chart for binary to decimal conversion would typically start with the binary number as input. Then, the flow chart would proceed to divide the binary number by increasing powers of 2, starting from the rightmost digit. The remainders obtained at each step would be used to construct the decimal equivalent of the binary number. Finally, the flow chart would output the decimal number as the result of the conversion process.
The conversion of octal number to binary can be obtained by using two methods. First, it can be converted into decimal and then obtained decimal is converted into binary. In the second method
sscanf, atoi, strtol, ...