SAP Tutorials Blog


 


PARAMETERS NUM TYPE I.

DATA FACT TYPE I VALUE 0.

PERFORM FACTORIAL USING NUM

CHANGING FACT.

WRITE :/ ‘FACTORIAL OF ‘, NUM,’=’, FACT.

*&———————————————————————*

*&      Form  FACTORIAL

*&———————————————————————*


FORM FACTORIAL  USING   VALUE(P_NUM)

CHANGING P_FACT.

P_FACT = 1.

WHILE P_NUM > 1.

P_FACT = P_FACT * P_NUM.

P_NUM = P_NUM – 1.

ENDWHILE.

ENDFORM.                    ” FACTORIAL


******************OUTPUT***************

FACTORIAL OF           5  =        120


Serkan AKKAVAK

Computer Engineer BSc

Head of SAP & Software Department

Contact : serkurumsal@yandex.com