Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 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, ntemp
  11. real:: u, y, ctf
  12. integer, dimension(:), allocatable :: temperatures
  13.  
  14. temperatureSum=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. print*, "enter value in celsius"
  26. read*, temp
  27.  
  28. temperatureSum = temperatureSum + ntemp
  29.  
  30. y=ctf(temp)
  31.  
  32. end do
  33.  
  34. u=(ntot/ntemp)
  35.  
  36. print*, "mean temp =", u
  37.  
  38. print*, "Temp in farenheit=", y
  39.  
  40. stop
  41.  
  42. end
  43.  
  44. real function ctf (a)
  45.  
  46. implicit none
  47.  
  48. real:: a
  49.  
  50. ctf=(a*(9.0/5)+32)
  51.  
  52. return
  53.  
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement