Click here to Skip to main content
14,667,185 members
Rate this:
Please Sign up or sign in to vote.
See more:
" - " ; mean Space

n=3

--*
-**
***

n= 5
----*
---**
--***
-****
*****
Posted
Updated 15-Feb-20 6:34am
v2
Comments
Richard MacCutchan 11-Dec-10 5:49am
   
If you realloy cannot figure out the algorithm for something like this, then you need to spend more time studying your language of choice.
Tarun.K.S 11-Dec-10 11:53am
   
it would require two or more for loops to achieve this. Try it! it ain't that tough. you can search on google too.

Rate this:
Please Sign up or sign in to vote.

Solution 1

My vote of one:

Please read the FAQs: We do not do your homework (and this is a pretty obvious homework task: I set it for my VB students) for you. For one thing, you won't benefit from it, for another nor will we.

As Richard MacCutchan sates, if you cannot do this, yourself then you need to practise / study a bit more. Honsetly, if you get it done, the sense of satisfaction should be more than worth the effort.
If you don't want to (or after much effort you still can't ) do this then IT isn't the career for you.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

.MODEL SMALL
.STACK  50H
.DATA
    NL  DB  0DH, 0AH, '$'         ; NL = NEXT LINE
.CODE
MAIN PROC
    MOV AX, @DATA
    MOV DS, AX
    MOV CX, 5
    MOV BX, 1
    FOR_1:
        PUSH    CX
        MOV DL, 20H    ; 20H IS ASCII CODE FOR SPACE
        MOV AH, 2
        FOR_2:
            INT 21H    ; PRINTING SPACES
        LOOP    FOR_2
        MOV CX, BX
        MOV DL, '*'
        MOV AH, 2
        FOR_3:
            INT     21H    ; PRINTING STARS
        LOOP    FOR_3
        LEA DX, NL
        MOV AH, 9
        INT     21H    ; MOVE CURSOR TO THE START OF NEXT LINE
        INC BX
        POP CX
    LOOP    FOR_1
    MOV AH, 4CH
    INT         21H
MAIN ENDP
    END MAIN
   
Comments
Dave Kreskowiak 15-Feb-20 12:54pm
   
Doing someones homework assignment for them, 10 years later, helps nobody.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100