How can I generate text file with all the prime numbers in progress 4gl

Discussão em 'StackOverflow' iniciado por fdantas, Novembro 22, 2016.

  1. fdantas

    fdantas Administrator Moderador

    In the below code i am importing a text file with numbers 3 to 99 .

    i have partially written code to find out the prime numbers from the given numbers.

    define variable a as integer.

    define variable b as integer.

    define variable i as integer initial 0.


    INPUT FROM Value ( "C:\src\New folder\bingo.txt").
    repeat :

    IMPORT a.
    b = a mod i.
    if b=0 then
    do:
    if a=i then
    do:
    message " prime number"a view-as alert-box.
    end.
    else if a<>i then
    do:
    i=i + 1.
    message " not prime number"a view-as alert-box.

    end.

    else if a < i then
    do:
    message "not prime number"a view-as alert-box.
    end.
    end.
    END.
    if b<>0 then
    do:
    i=i + 1.
    message "b<>0"b view-as alert-box.
    end.
    end.
    Output To Value( "C:\src\New folder\even.txt")append.
    export a space.
    output close.
    end.
    end.


    help me with . to program

    Continue reading...

Compartilhe esta Página