tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
19
Task/Nth-root/HicEst/nth-root.hicest
Normal file
19
Task/Nth-root/HicEst/nth-root.hicest
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
WRITE(Messagebox) NthRoot(5, 34)
|
||||
WRITE(Messagebox) NthRoot(10, 7131.5^10)
|
||||
|
||||
FUNCTION NthRoot(n, A)
|
||||
REAL :: prec = 0.001
|
||||
|
||||
IF( (n > 0) * (A > 0) ) THEN
|
||||
NthRoot = A / n
|
||||
DO i = 1, 1/prec
|
||||
x = ((n-1)*NthRoot + A/(NthRoot^(n-1))) / n
|
||||
IF( ABS(x - NthRoot) <= prec ) THEN
|
||||
RETURN
|
||||
ENDIF
|
||||
NthRoot = x
|
||||
ENDDO
|
||||
ENDIF
|
||||
|
||||
WRITE(Messagebox, Name) 'Cannot solve problem for:', prec, n, A
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue