decimal.f90
I suggest you either typed this as it appears into the compiler, or as
an easier way, just copy and paste it!
Note: I do not claim
the program will 100% work, but I give it my best. If it doesn't, try tweaking
it yourself, or email me about it, and I'll modify and post the improved version
later. Good luck!
Program binary_to_decimal
Implicit none
! Type binarynumbers
! Integer :: 1, 0.0
! End type binarynumbers
! Type decimalnumbers
! Integer :: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
! End type binarynumbers
Integer :: z1, y1, x1, w1, v1, u1, t1, s1, r1, q1, p1, o1, n1, m1, l1, k1, j1, I1, h1, g1, f1, e1, d1, c1, b1, a1
integer :: sum
integer :: z, y, x, w, v, u, t, s, r, q, p, o, n, m, l, k, j, i, h, g, f, e, d, c, b, a
!Type (binarynumbers):: z, y, x, w, v, u, t, s, r, q, p, o, n, m, l, k, j, i, h, g, f, e, d, c, b, a
! Type (decimalnumbers):: dec_no
Print*, "please input a binary number consisting of 0’s, and 1’s"
Print*, "please input the binary numbers from right to left [<--]"
Print*, "e.g: the binary number 1011 should be entered as 1 then 1 then 0 then 1 --> 1101"
Print*, "enter the first value, then press spacebar and enter the next value"
Print*, "e.g: 1101 ( 1 space 1 space 0 space 1 enter"
Print*, "there are 26 fields in all, so if you have finished with the binary numbers (of less than 26, please enter a value of zero (0) for the remaining fields"
Read*, a, b, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
!binary number changer to decimal
a1=a*1
b1=b*2
c1=c*4
d1=d*8
e1=e*16
f1=f*32
g1=g*64
h1=h*128
i1=I*256
j1=J*512
k1=K*1024
l1=L*2048
m1=M*4096
n1=N*8192
o1=o*16384
p1=P*32768
q1=Q*65536
r1=R*131072
s1=S*262144
t1=T*524288
u1=U*1048576
v1=V*2097152
w1=W*4194304
x1=X*8388608
y1=Y*16777216
z1=Z*33554432
Sum = z1+ y1+ x1+ w1+ v1+ u1+ t1+ s1+ r1+ q1+ p1+ o1+ n1+ m1+ l1+ k1+ j1+ I1+ h1+ g1+ f1+ e1+ d1+ c1+ b1+ a1
Print*, "the decimal number for ", z, y, x, w, v, u, t, s, r, q, p, o, n, m, l, k, j, i, h, g, f, e, d, c, b, a, "binary number is ", sum
Print*, "thank you for using adcy binary-decimal conversion program"
Print*, "have a nice day:)"
End program