Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PROGRAM FOR PRIME NUMBERS

Former Member
0 Likes
1,401

WRITE A PROGRAM FOR PRIME NUMBERS FROM 0 TO 100

2 REPLIES 2
Read only

Former Member
0 Likes
501

Check out this related threads

Read only

praveen_hannu
Contributor
0 Likes
501

DATA: num type i,

div TYPE i,

num1 type i,

num2 TYPE i,

per type i.

num = 100.

num1 = 1.

write: / 'List of Prime Numbers'.

do num TIMES.

add 1 to num1.

div = 2.

if num1 le 3.

write: / num1 LEFT-JUSTIFIED.

else.

do num1 times.

per = num1 mod div.

if per eq 0.

exit.

endif.

num2 = num1 / 2.

if div eq num1 or div ge num2 .

IF per ne 0.

WRITE: / num1 LEFT-JUSTIFIED.

exit.

ENDIF.

else.

add 1 to div.

CONTINUE.

endif.

enddo.

endif.

enddo.

Try this..

Regards

Praveen