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

what is difference between user exit, customer exit and badi?

4559


What is a development class? : abap data dictionary

909


List the events in abap/4 language?

786


What are control tables?

860


If I have put commit in badi implementation class after update, is it allowed? Also if some standard functionality already implemented an update and now i m doing update and if it fails, what will be the impact of commit?

1541


Explain the difference between a pool table and a transparent table?

721


Explain about interactive report?

779


A function module can be called from a transaction screen outside an abap/4 program. State true or false. : abap modularization

735


What is the use of the raising exception?

753


What is view? Explain the different types of view?

949


what is the difference between hashed & sorted internal tables?

1852


What are interface/conversion programs in SAP?

791


How can we declare a table control in the abap/4 program?

841


what are the critical issues u face in ur project?

2212


What is the major difference between pool tables and transparent tables?

722