File: file_17.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (26 lines) | stat: -rw-r--r-- 557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program file_17

    integer :: i
    real :: arr(3)
    real :: a, b, c
    arr(1) = 100.123
    arr(2) = -2.14
    arr(3) = 528.156

    open(10, file="file_17_util.txt", status="replace")
    write(10, "((es23.16))") (arr(i), i=1, size(arr))
    close(10)

    open(10, file="file_17_util.txt")
    read(10, *) a, b, c
    close(10)

    print *, arr(1), a
    print *, arr(2), b
    print *, arr(3), c

    if (abs(arr(1) - a) > 1e-5) error stop
    if (abs(arr(2) - b) > 1e-5) error stop
    if (abs(arr(3) - c) > 1e-5) error stop

end program file_17