Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Small logic in ABAP

Hi,

am very new to abap , i have the logic of Prime number in c language , i want to do it in ABAP ,

so kindly help me .

thanks,

Sudhakar

Tags:
Former Member
Former Member replied

REPORT Z_PRIME.

data : num type i value 3,

max type i,rem type i,div type i value 2,

flag type boolean.

do.

max = num div 2.

do.

rem = num mod div.

if rem = 0 .

flag = 1.

exit.

endif.

div = div + 1.

if div > max.

exit.

endif.

enddo.

if flag = 0.

write:/ num.

endif.

flag = 0.

num = num + 1.

div = 2.

if num > 100.

exit.

endif.

enddo.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question