Question

A program t outputs three triangles of asterisks in C with the help of function and...

A program t outputs three triangles of asterisks in C with the help of function and then translate into assembly language in Pep/9.

Available answer on chegg is not giving output on Pep/9.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

; program inputs m then prints a triangle of stars with

; m rows of stars. The first row has m stars, the second

; has m-1 stars, the third has m-2 stars and so on.

;

stro prompt,d

deci numrows,d ; number of rows to print

top:   ldwa numrows,d

stwa numonrow,d ; inner loop limit is same as rows left

top2: ldba '*',i

stba charOut,d

ldwa numonrow,d

suba 1,i

stwa numonrow,d ; number of stars left to print on line

brne top2 ; branch if more to print on this line

ldba '\n',i

stba charOut,d ; no more so output newline character

ldwa numrows,d

suba 1,i

stwa numrows,d ; number of rows to print is decreased

brne top ; branch if more rows to print

stop

numonrow: .block 2 ; inner loop counter

numrows: .block 2 ; number of rows still to print

prompt: .ascii “Enter number of rows\x00”

.end

Add a comment
Know the answer?
Add Answer to:
A program t outputs three triangles of asterisks in C with the help of function and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT