Do you Know ?

Program to display Triangle/Pyramid/Stars in SAP ABAP.

Displaying triangle/pyramid/stars in SAP ABAP.

In C Programming displaying the pyramid is quite a simple task with using the loops,
When it comes to the ABAP Programming it’s a bit a difficult task to achieve.

Well, having said that this code make sure that task is no longer difficult for you.

Here is the program using the parameter option to display the pyramid/triangle.


Code:

*&---------------------------------------------------------------------*
*& Report  ZSTARS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSTARS.
data b(10) type n.
parameter a(10) type n.
b = 1.
do a times.
do b times.
write '*'.
enddo.
write:/.
b = b + 1.
enddo

Input:


Output:


Displaying Stars in Decending Order in SAP ABAP : 

Code:

*&---------------------------------------------------------------------*
*& Report  ZSTARS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSTARS.
data b(10) type n.
parameter a(10) type n.
b = 1.
do a times.
do a times.
write '*'.
enddo.
write:/.
a = a  - b.
enddo
*****************************************************************


Input :





Output: