§ Текст программы

10 DIM Z(255)
11 LET D=0
12 LET P=0
20 LET M=250
21 FOR I=1 TO M
30 LET Z(I)=20
31 NEXT I
32 PRINT "PI=";
40 LET E=D-100*INT(D/100)
41 LET D=0
42 FOR I=1 TO M
50 LET J=M-I
51 LET D=D+D*J+Z(J+1)*100
60 LET A=J+J+1
61 LET Z(J+1)=D-A*INT(D/A)
62 LET D=INT(D/A)
70 NEXT I
71 LET M=M-6
72 LET E=E+INT(D/100)
80 PRINT INT(E/10);
81 IF P=0 THEN PRINT ".";
82 LET P=1
90 PRINT E-10*INT(E/10);
91 IF M>10 THEN GO TO 40

§ Иллюстрация программы


§ Реализация на С

#include <stdio.h>

int main() {

    int z[256];
    int a, j, d = 0, p = 0, m = 250, e;
    for (int i = 1; i <= m; i++) z[i]=20;
    printf("PI=");

    do {

        e = d % 100;
        d = 0;
        for (int i = 1; i <= m; i++) {
            j = m - i;
            d += (d*j + z[j+1]*100);
            a = 2*j+1;
            z[j+1]= d % a;
            d /= a;
        }

        m -= 6;
        e += (d / 100);
        printf("%d", e/10);
        if (p == 0) { printf("."); p = 1; }
        printf("%d", e % 10);

    } while (e > 10);

    printf("\nPI=3.141592653589793238462643383279502\n");
    return 0;
}