AnonymousEng

Ex:5a - page 163

Jan 14th, 2013
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       dimension SALES(6,10)
  2. c     ! filling the sales array using read method
  3.  
  4.       do 10 i=1,6
  5.          read(*,*) (SALES(i,j),j=1,10)
  6.  10   continue
  7.  
  8. c     ! here we will sum every row only and print each row result
  9.       do 20 i=1,6
  10.          WSTORE = 0
  11.          do 25 j=1,10
  12.             WSTORE = WSTORE + SALES(i,j)
  13.  25      continue
  14.          write(*,*) WSTORE
  15.  20   continue
  16.  
  17. c     ! here we will sum each column result (we replaced i,j to j,i)
  18.       do 30 i=1,6
  19.          DEPART = 0
  20.          do 35 j=1,10
  21.             DEPART = DEPART + SALES(j,i)
  22.  35      continue
  23.          write(*,*) DEPART
  24.  30   continue
  25.  
  26. c     ! here we will sum (all the array)(we removed DEPART=0)
  27.       do 40 i=1,6
  28.  
  29.          do 45 j=1,10
  30.             SUM = SUM + SALES(i,j)
  31.  45      continue
  32.  40   continue
  33.       write(*,*)SUM
  34.      
  35.       PAUSE
  36.       STOP
  37.       END
Advertisement
Add Comment
Please, Sign In to add comment