RosettaCodeData/Task/Arithmetic-geometric-mean/GW-BASIC/arithmetic-geometric-mean.basic
2023-07-01 13:44:08 -04:00

8 lines
135 B
Text

10 A = 1
20 G = 1!/SQR(2!)
30 FOR I=1 TO 20 'twenty iterations is plenty
40 B = (A+G)/2
50 G = SQR(A*G)
60 A = B
70 NEXT I
80 PRINT A