Mercurial > hg > octave-nkf
annotate examples/fortsub.f @ 12583:bb29b58e650c release-3-4-x
abandon release-3-4-x branch in favor of workflow using stable and default branches and merging stable to default periodically
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Apr 2011 09:06:04 -0400 |
parents | 4295d634797d |
children |
rev | line source |
---|---|
6572 | 1 subroutine fortsub (n, a, s) |
2 implicit none | |
3 character*(*) s | |
4 real*8 a(*) | |
5 integer*4 i, n, ioerr | |
6 do i = 1, n | |
7 if (a(i) .eq. 0d0) then | |
8 call xstopx ('fortsub: divide by zero') | |
9 else | |
10 a(i) = 1d0 / a(i) | |
11 endif | |
12 enddo | |
13 write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr) | |
7081 | 14 $ 'There are ', n, |
15 $ ' values in the input vector', char(0) | |
6572 | 16 if (ioerr .ne. 0) then |
17 call xstopx ('fortsub: error writing string') | |
18 endif | |
19 return | |
20 end | |
21 |