Skip to Content
author's profile photo
Former Member

hi plz tell me to get yhe output

1

1 2

1 2 3

1 2 3 5

1 2 3 5 7

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • author's profile photo
    Former Member
    Posted on Sep 21, 2007 at 12:14 PM

    1

    12

    123

    1235

    12357

    1235

    123

    12

    1

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 21, 2007 at 01:24 PM

    Hi Kalyan

    Take the first piece of code for your issue. reward if useful

    Fina,

    Take the whole piece of code for your issue. reward if useful

    DATA : VAR1(2) TYPE C,

    VAR2(2) TYPE C,

    VAR3(2) TYPE C,

    VAR4(2) TYPE C,

    temp(2) type c.

    temp = 5.

    DO temp TIMES.

    VAR1 = VAR1 + 1.

    VAR2 = 1.

    DO VAR1 TIMES.

    IF SY-INDEX = 1.

    WRITE : VAR2.

    VAR3 = 1.

    var4 = 1.

    ELSE.

    IF VAR3 le 2.

    VAR3 = VAR3 + 1.

    VAR2 = VAR2 + VAR4.

    WRITE : VAR2.

    ELSE.

    VAR4 = VAR4 + 1.

    var2 = var2 + var4.

    write : var2.

    CLEAR VAR3.

    var3 = 2.

    ENDIF.

    ENDIF.

    ENDDO.

    WRITE : /.

    ENDDO.

    var1 = temp.

    DO temp TIMES.

    var1 = VAR1 - 1.

    VAR2 = 1.

    DO VAR1 TIMES.

    IF SY-INDEX = 1.

    WRITE : VAR2.

    VAR3 = 1.

    var4 = 1.

    ELSE.

    IF VAR3 le 2.

    VAR3 = VAR3 + 1.

    VAR2 = VAR2 + VAR4.

    WRITE : VAR2.

    ELSE.

    VAR4 = VAR4 + 1.

    var2 = var2 + var4.

    write : var2.

    CLEAR VAR3.

    var3 = 2.

    ENDIF.

    ENDIF.

    ENDDO.

    WRITE : /.

    ENDDO.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 21, 2007 at 01:58 PM

    Hi Kalyan,

    if you want to create this as a print or list output using ABAP, you can do this:

    write: / '1', /'1 2',/'1 2 3',/'1 2 3 5', /'1 2 3 5 7'.
    

    If there is anything more behind, you may elaborate.

    Regards,

    Clemens

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 25, 2007 at 09:48 AM

    hi,

    try this.

    PARAMETERS : pno TYPE i DEFAULT 5.

    DATA : num TYPE i VALUE 1,

    num1 TYPE string ,

    num2 TYPE string,

    rem TYPE i,

    div TYPE i VALUE 2,

    lp TYPE i.

    num1 = num.

    lp = pno - 2.

    DO pno TIMES.

    div = 2.

    IF num LE 3.

    CONCATENATE num1 num2 INTO num2 SEPARATED BY space.

    num1 = num2.

    WRITE:/ num2.

    ELSE.

    DO lp TIMES.

    IF div < num.

    rem = num MOD div.

    IF rem = 0.

    EXIT.

    ENDIF.

    div = div + 1.

    ENDIF.

    ENDDO.

    IF rem <> 0.

    CONCATENATE num1 num2 INTO num2 SEPARATED BY space.

    num1 = num2.

    WRITE:/ num2.

    ENDIF.

    ENDIF.

    num = num + 1.

    num2 = num.

    ENDDO.

    it will solve ur problem.

    reward if useful.

    Add comment
    10|10000 characters needed characters exceeded