Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get this typical outpt

Former Member
0 Kudos

1

1 2 3

1 2 3 5

1 2 3 5 7

1 2 3 5 7 11

1 2 3 5 7 11 13

1 2

please very urgent

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HAI,

see the program below apply the logic to ur program.

data : int1 type i value 1,

int2 type i value 1,

int3 type i,

int4 type i,

count type i value 1.

parameter : value type i.

int3 = value.

while ( int1 < int3 ).

while ( int2 <= int1 ).

write : INT2..

int2 = int2 + 1.

endwhile.

write :/.

int1 = int1 + 1 .

int2 = 1.

endwhile.

6 REPLIES 6

Former Member
0 Kudos

HAI,

see the program below apply the logic to ur program.

data : int1 type i value 1,

int2 type i value 1,

int3 type i,

int4 type i,

count type i value 1.

parameter : value type i.

int3 = value.

while ( int1 < int3 ).

while ( int2 <= int1 ).

write : INT2..

int2 = int2 + 1.

endwhile.

write :/.

int1 = int1 + 1 .

int2 = 1.

endwhile.

0 Kudos

HI VIKRAM,MANY THANKS BUT I WANT ODD NUMBERS AFTER 2 'S DISPLAY. I GOT THE OUTPUT AS U GAVE ME BUT I AM NOT GETTING THE ODD ONES.CANU TRY PLSSSS

Former Member
0 Kudos

try this


PARAMETERS : P_NO TYPE I DEFAULT 5.
DATA : VAL TYPE I,
       DIV TYPE I,
       REM TYPE I,
       EVEN.

DATA : BEGIN OF IODD OCCURS 0,
       VAL TYPE I,
       END OF IODD.
DO P_NO TIMES.
REM = 1.
VAL = VAL + 1.
 DO VAL TIMES.
  DIV = DIV + 1.
  IF DIV LT VAL AND DIV GT 1.
    REM = VAL MOD DIV.
   ENDIF.
  IF REM EQ 0.
    EVEN = 'X'.
  ENDIF.
 ENDDO.
 IF EVEN IS INITIAL.
    IODD-VAL = VAL.
    APPEND IODD.
 ENDIF.
 CLEAR : DIV,EVEN.
ENDDO.
CLEAR : VAL,DIV,REM.
SORT IODD BY VAL.
DESCRIBE TABLE IODD LINES DIV.
DO DIV TIMES.
VAL = VAL + 1.
LOOP AT IODD.
REM = REM + 1.
IF REM LE VAL.
WRITE : IODD-VAL.
ENDIF.
ENDLOOP.
WRITE : / .
CLEAR : REM.
ENDDO.

regards

shiba dutta

0 Kudos

hi shiba dutta,

thanks a lot for ur support.its working.pls continue ur support.

-


kartikeya bommuluri

Former Member
0 Kudos

100 percent succesfull and solved

0 Kudos

I forgot to say wel come to SDN . In this forum Better way to say thanks by assigning points to the helpful answers. You can assign the points by clicking the star ( * ) marks left of each answer. 2 for yellow, 6 for green and 10 for black.

Please assign the marks to all the helpful answers accordingly.

regards

shiba dutta