on 2016 Jan 27 5:05 AM
Hi Experts,
Can anybody tell me how to develop a pascal triangle program in ABAP.
REPORT ZBH_TEST_PASCAL.
data : row type i value 0,
colspaces type i,
colchar type i.
parameters noofrows type i.
do noofrows times.
colspaces = noofrows - row.
while colspaces >= 1.
write ' '.
colspaces = colspaces - 1.
endwhile.
data: printchar type i,
num type i,
den type i.
printchar = 1.
num = row.
den = 1.
colchar = 0.
while colchar <= row.
write printchar.
printchar = printchar * num.
printchar = printchar / den.
num = num - 1.
den = den + 1 .
colchar = colchar + 1.
ENDWHILE.
write /.
row = row + 1.
ENDDO.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Stefan,
Thank you for the reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tushar,
welcome in the world of ABAP.
Sometimes it is good to do a step back and to keep occupied with seemingly insignificant problems. Here a link to a description of the Pascal's triangle, for all who don't know the exact definition - like me.
Good luck to your ABAP career, and be never shy to ask.
Cheers
Stefan
User | Count |
---|---|
11 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.