Write float arrays to a text file: Difference between revisions
m
→{{header|Fortran}}
m (→{{header|Stata}}: +output) |
|||
Line 476:
=={{header|Fortran}}==
=== Fortran 90 ===
data x / 1.0, 2.0, 4.0, 1.0e11 /▼
do 10 i = 1, 4▼
y = sqrt(x)▼
10 continue▼
open(unit=15, file='two_cols.txt', status='new')▼
write(15,'(f20.3,f21.4)') (x(I), y(I), I = 1, 4)▼
end</lang>▼
{{works with|Fortran|90 and later}}
<lang fortran>program writefloats
Line 517 ⟶ 506:
The arrays x and y should have same bounds (and size); this constraint is not checked.
=== Fortran 77 ===
<lang fortran> program writefloats
integer i
double precision x(4), y(4)
▲ do 10 i = 1, 4
▲ y = sqrt(x)
▲ 10 continue
▲ open(unit=15, file='two_cols.txt', status='new')
▲ end</lang>
=={{header|FreeBASIC}}==
|