products/sources/formale Sprachen/C/Lyx/lib/reLyX image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: primes.cob   Sprache: Unknown

       Identification Division.
       Program-Id. primes.
       author. Robert Sedgewick.
      * Primzahlen
      * aus Algorithmen p36 
       Data Division.
       Working-Storage Section.
         78 N           value 1000.
         01 a     pic 9(1) occurs N.
         77 i     pic 9(4).
         77 j     pic 9(4).
         77 t     pic 9(4).
       Procedure Division.
        Move 0 to a(1)
        Perform varying i from 2 until i=N
          move 1 to a(i)
          Perform varying j from 2 until j=N / i
            compute t=i*j
            move 0 to a(t)
          end-perform
        end-perform
        Perform varying i from 2 until i=N
          if a(i)=1 then
            display i
        end-perform
       End-Program primes.
  

[ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet)  ]