You are on page 1of 2

program conversion_de_temperaturas

implicit none

real::K,C,F,R
integer::temp

write(*,*) 'Eliga una opcion que realice la conversion de temperatura'


write(*,*) 'ya sea de grados C,F o R a grados Kelvin'

write(*,*) '(1) Celcius a Kelvin'


write(*,*) '(2) Farenheit a Kelvin'
write(*,*) '(3) Rankine a Kelvin'
write(*,*) '(4) Kelvin a Kelvin'

read(*,*) temp

if(temp==1) then

call patatas(C,K)

else
if(temp==2) then

call patatas2(F,K)

else
if(temp==3) then

call patatas3(R,K)

else

call patatas4(K)

end if
end if
end if

end program

subroutine patatas(C,K)
implicit none

Real::C,K

write(*,*) 'Ingrese la temperatura en Celcius'


read(*,*) C

K=C+273.15

write(*,*)'K=', K

return
end subroutine

subroutine patatas2(F,K)
implicit none

Real::F,K
write(*,*) 'Ingrese la temperatura en Farenheit'
read(*,*) F

K=((F-32)/1.8)+273.15

write(*,*)'K=', K

return
end subroutine

subroutine patatas3(R,K)
implicit none

Real::R,K

write(*,*) 'Ingrese la temperatura en Rankine'


read(*,*) R

K=((R-491.67)/1.8)+273.15

write(*,*)'K=', K

return
end subroutine

subroutine patatas4(K)
implicit none

Real::K

write(*,*) 'Ingrese la temperatura en Kelvin'


read(*,*) K

write(*,*)'K=', K

return
end subroutine

You might also like