Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Nth-root/RATFOR/nth-root.ratfor
Normal file
35
Task/Nth-root/RATFOR/nth-root.ratfor
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
program nth
|
||||
#
|
||||
integer root
|
||||
real number, precision
|
||||
real temp0, temp1
|
||||
|
||||
1 format('Enter the base number: ')
|
||||
2 format('Enter the desired root: ')
|
||||
3 format('Enter the desired precision: ')
|
||||
4 format(F12.6)
|
||||
5 format(I6)
|
||||
write(6,1)
|
||||
read(5,4)number
|
||||
write(6,2)
|
||||
read(5,5)root
|
||||
write(6,3)
|
||||
read(5,4)precision
|
||||
|
||||
temp0 = number
|
||||
temp1 = number/root
|
||||
|
||||
while ( abs(temp0 - temp1) > precision )
|
||||
{
|
||||
temp0 = temp1
|
||||
temp1 = ((root - 1.0) * temp1 + number / temp1 ** (root - 1.0)) / root
|
||||
}
|
||||
|
||||
6 format(' number root precision')
|
||||
write(6,6)
|
||||
7 format(f12.6,i6,f12.6)
|
||||
write (6,7)number,root,precision
|
||||
8 format('The root is: ',F12.6)
|
||||
write (6,8)temp1
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue