Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. program temperature
  2.  
  3. !write a program that askes for n temperatures, then asks what these
  4. !n temperatures are in celsius. Then, it prints the average of these
  5. !temperatures in farenheit
  6. !write a celsius to farenheit fucntion
  7.  
  8. implicit none
  9.  
  10. integer:: temperaturesum, J, i, n
  11. real:: u, y, ctf, ntemp
  12. integer, dimension(:), allocatable :: temperatures
  13.  
  14. ntot=0
  15. J=0
  16.  
  17. print*, "enter number of temperatures"
  18.  
  19. read*, ntemp
  20.  
  21. allocate(temperatures(ntemp))
  22.  
  23. do i=1, ntemp
  24.  
  25. J=J+1
  26.  
  27. print*, "enter value in celsius"
  28. read*, temp
  29.  
  30. temperaturesum = temperaturesum + n
  31.  
  32. y=ctf(temp)
  33.  
  34. end do
  35.  
  36. u=(ntot/J)
  37.  
  38. print*, "mean temp =", u
  39.  
  40. print*, "Temp in farenheit=", y
  41.  
  42. stop
  43.  
  44. end
  45.  
  46. real function ctf (a)
  47.  
  48. implicit none
  49.  
  50. real:: a
  51.  
  52. ctf=(a*(9.0/5)+32)
  53.  
  54. return
  55.  
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement