Determine if a number is within a range.

Given three arguments, n, min, and max, return true if n is within the range minmax.

1
2
2 1 3 ⟹ true
1 2 3 ⟹ false

Compiled as Cobol 2002 by cobc (GNU Cobol) 1.1.0.

program-id. inrange is initial.
data division.
linkage section.
    01 n pic S99.
    01 x1 pic S99.
    01 x2 pic S99.
    01 result pic x.
procedure division using n, x1, x2, result.
    move 'f' to result.
    if (x1 <= n and n <= x2) move 't' to result.
end program inrange.