home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
adaptor
/
examples
/
fakul
/
fakul1.f
< prev
next >
Wrap
Text File
|
1993-06-28
|
945b
|
42 lines
Program fakul
CC
CC Fakultaetsprogram, FORTRAN 90 Version
CC
integer max
integer feld(:), carry(:)
integer I,K,N
integer length
integer s, lastval
print *, 'Input value N !'
read *, N
print *, 'Input upper limit for size !'
read *, max
allocate (feld(1:max), carry(1:max))
feld = 0
carry = 0
feld(1)=1
length = 1
do K=N,1,-1
!hpf$ independent, local_access
do I = 1, length
feld(i) = (feld(i) + carry(i))*K
carry(i) = feld(i) / 65536
feld(i) = feld(i) - carry(i) * 65536
end do
if (carry(length) .NE. 0) length = length + 1
carry = cshift (carry,1,-1)
end do
lastval = feld(length)
s = sum (feld)
print *, 'Size = ', length
print *, 'Lastval = ', lastval
print *, 'Control sum = ', s
deallocate (carry, feld)
end