jainamichelle
Technical User
Hi all,
I need help writing a program, using Fortran 90, to convert numerical values into binary then add them.
I'm able to convert numbers into binary, but I'm having difficulty adding two binary numbers. All I know is that I have to use a loop to add corresponding digits, starting with the lower digit, and the carry digits.
So far I have...
program ItAllAddsUp
implicit none
integer:: x=13, y=23, I, J,
integer:: Array1(8)
integer:: Array2(8)
integer:: Array3(8)
!Array for x value
do I=8, 1, -1
Array1(I)=MOD(x, 2)
x=x/2
end do
!Array for y value
Do J=8, 1, -1
Array2(J)=MOD(y, 2)
y=y/2
end do
end program ItAllAddsUp
----
Any help would be much appreciated.
Thank you very much
I need help writing a program, using Fortran 90, to convert numerical values into binary then add them.
I'm able to convert numbers into binary, but I'm having difficulty adding two binary numbers. All I know is that I have to use a loop to add corresponding digits, starting with the lower digit, and the carry digits.
So far I have...
program ItAllAddsUp
implicit none
integer:: x=13, y=23, I, J,
integer:: Array1(8)
integer:: Array2(8)
integer:: Array3(8)
!Array for x value
do I=8, 1, -1
Array1(I)=MOD(x, 2)
x=x/2
end do
!Array for y value
Do J=8, 1, -1
Array2(J)=MOD(y, 2)
y=y/2
end do
end program ItAllAddsUp
----
Any help would be much appreciated.
Thank you very much