Next: Problems
Up: A quick tour of
Previous: Repetitive action
  Contents
Write a program that converts the temperature from Fahrenheit
degrees to Celsius degrees (centigrades).
The steps are:
- Problem formulation
- Algorithm
- Implementation
- Run, and if the result is wrong, loop back.
program temp_conv
implicit none
integer :: n ! no. of temperatures to convert
real :: f,c ! temp. values in F,C
integer :: i ! loop counter
print*,'No. of conversions='
read*,n
do i=1,n
print*,'Fahrenheit temp. no ',i,'='
read*,f
c=9.0/5.0*(f-32)
print*,f,' F is ',c,' C'
end do
end program temp_conv
Adrian Sandu
2001-08-26