write the program for prime numbers between 1 to 1000

Answer Posted / kallol banerjee

data: n type i default 1,
m type i,
p type i,
r type p decimal 2,
l_v_cnt type n.

do n times.
if n <= 1000.
m = 1.
do m times.
if m <= n.
r = n / m.
p = n / m.
m = m + 1.
if r = p.
l_v_cnt = l_v_cnt + 1.
endif.
endif.
enddo.
else.
exit.
endif.
if l_v_cnt = '2'.
write: n.
endif.
n = n + 1.
enddo.

Is This Answer Correct ?    19 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If I forgot some command in sap script e.g.: Suppress zero display – how to do find it?

565


What are the differences between domain and data element?

576


How to combine multiple order in one Delivery ( Step by Step)?

1983


What is sap abap data dictionary?

638


What does a lock object involve?

673






Difference between /N and /BEND?

825


How do we assign dynamic views while creating material master and generating bdc? : abap bdc

633


How do you find if a logical database exists for your program requrements?

607


Explain what are standard layouts sets in the sap script?

943


What are hashed tables?

873


Why we are using Macros instead of Function Modules

1619


What is the use of info groups? : sap abap hr

564


What is netweaver???what is the relationship with ABAP?

1631


in bdc session method. if u run the record in fore ground manually i have a 7 records but at the time of record processing first record produces the error how can u process records manually in fore ground please tell me any one knows?

1745


What are the differences between table controls and step loops?

563