Created
January 27, 2025 23:52
-
-
Save ivan-pi/3a334a95eb9718c6680b97309d68af15 to your computer and use it in GitHub Desktop.
Computation of a square root (https://x.com/CalyaConsult/status/1877648229740732824)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C BERECHNUNG EINER QUADRATWURZEL | |
1 READ(*,100) Z | |
100 FORMAT(F9.3) | |
WRITE(*,101) | |
101 FORMAT(6X,13HQUADRATWURZEL) | |
WRITE(*,102) | |
102 FORMAT(//6X,1HZ,11X,1HW) | |
2 WN=1.0 | |
3 WN1=0.5*(WN + Z/WN) | |
WRITE(*,300) WN1 | |
300 FORMAT(24X,F9.3,2X,9HITERATION) | |
4 IF(0.001-ABS(WN1-WN))5,5,6 | |
5 WN=WN1 | |
GOTO 3 | |
6 WRITE(*,600) Z,WN1 | |
600 FORMAT(1X,F9.3,3X,F9.3) | |
7 END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment