RosettaCodeData/Task/Arithmetic-geometric-mean/GW-BASIC/arithmetic-geometric-mean.basic

9 lines
135 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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