*&---------------------------------------------------------------------*
" Numero primo
*&---------------------------------------------------------------------*
REPORT ZPROGR_02.
PARAMETERS: N1 TYPE I.
DATA: I1 TYPE I VALUE 1,
B TYPE I,
A TYPE I.
WHILE ( I1 <= N1 ).
B = N1 MOD I1.
IF ( B = 0 ).
A = A + 1.
ENDIF.
I1 = I1 + 1.
ENDWHILE.
IF A <= 2.
WRITE 'SI ES PRIMO'.
ELSE.
WRITE 'NO ES PRIMO'.
ENDIF.
No hay comentarios:
Publicar un comentario