home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
adaptor.zip
/
adapt.zip
/
adaptor
/
examples
/
dalib
/
reduct
/
integer.f
< prev
next >
Wrap
Text File
|
1993-06-25
|
2KB
|
77 lines
program test
integer k
parameter (k = 3)
integer a(k)
a(1) = 7
a(2) = 3
a(3) = 10
call sumtest (a, k, 20)
call prodtest (a, k, 210)
call mintest (a, k, 3)
call maxtest (a, k, 10)
call andtest (a, k, 2)
call ortest (a, k, 15)
call eortest (a, k, 14)
end
subroutine sumtest (a, N, result)
integer a(n), s, result
s = sum (a)
print *, 'SUM: Result is ', s, ' should be ', result
end
subroutine prodtest (a, N, result)
integer a(n), s, result
s = product (a)
print *, 'PRODUCT: Result is ', s, ' should be ', result
end
subroutine mintest (a, N, result)
integer a(n), s, result
s = minval (a)
print *, 'MINVAL: Result is ', s, ' should be ', result
end
subroutine maxtest (a, N, result)
integer a(n), s, result
s = maxval (a)
print *, 'MAXVAL: Result is ', s, ' should be ', result
end
subroutine andtest (a, N, result)
integer a(n), s, result
s = iall (a)
print *, 'IALL: Result is ', s, ' should be ', result
end
subroutine ortest (a, N, result)
integer a(n), s, result
s = iany (a)
print *, 'IANY: Result is ', s, ' should be ', result
end
subroutine eortest (a, N, result)
integer a(n), s, result
s = iparity (a)
print *, 'IPARITY: Result is ', s, ' should be ', result
end