When I run the code for Celsius only I am getting the result below the code:
program temperature
! F C temperature conversion
implicit none
real :: celcius=0.0, fahrenheit=0.0
integer:: t,n
print *,'enter the number of lines'
read*, n
do n=1,n
print*,'enter the value of t: one per line',n
read*, t
celcius=5/9*(t-32)
enddo
do n=1,n
print*, t, celcius
enddo
end program
result
enter the number of lines
3
enter the value of t: one per line 1
50
enter the value of t: one per line 2
20
enter the value of t: one per line 3
10
10 0.00000000E+00
10 0.00000000E+00
10 0.00000000E+00
10 0.00000000E+00
It's clear that compiler is not picking the value of t in the calculation.
toutside the loop. If you want to use multiple values you should use an array, or restructure the rest around the first loop.