Mercurial > octave-nkf
annotate examples/fortsub.f @ 6909:fc55a5e1760b ss-2-9-14
[project @ 2007-09-17 20:47:40 by jwe]
author | jwe |
---|---|
date | Mon, 17 Sep 2007 20:47:41 +0000 |
parents | 8e7148b84b59 |
children | 4270ded9ddc6 |
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) | |
14 $ 'There are ', n, ' values in the input vector', | |
15 $ char(0) | |
16 if (ioerr .ne. 0) then | |
17 call xstopx ('fortsub: error writing string') | |
18 endif | |
19 return | |
20 end | |
21 |