 # Binomial Coefficients Program Requirements Write an assembly la...

## Question

Binomial Coefficients Program Requirements

Write an assembly language program and create an accompanying problem document.

Program Requirements

Design a recursive procedure to calculate Binomial Coefficients.

The procedure should expect two arguments on the stack, and should return the answer in eax. Only eax may be altered by your procedure. If you use local storage, it must be allocated on the stack.

Binomial(4,2) should return 6
Binomial(3,0) should return 1
etc.

This procedure must be in a file by itself.

You must also create an application that allows the user to enter an integer. The program then must use the binomial coefficient procedure to calculate the coefficients of (a+b)n. These should be displayed on one line of output.

The program should repeat until 0 is entered.

Remember to document the program, as well as each procedure, as required by the CS370 Coding and Documentation Standards.

Sample Output

Please enter an integer: 3
1 3 3 1
Please enter an integer: 4
1 4 6 4 1
Please enter an integer: 0
Bye!

Problem Document

The problem document will contain:

1. Pseudo-code algorithm(s) for main and the binomial procedures.
Do NOT mention the stack or registers in the pseudo code.
2. A test plan and results.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Pseudo-code:

1) binomial procedure

if k equals 0 then return 1;
if k equals n then return 1;
if k is less than 0 then return 0;
if k is greater than n then return 0;
if n is less than 0 then return 0;

else return
binomial procedure(n-1, k) + binomial procedure(n-1, k-1);

C code :
int binomial_coef(int n, int k)
{
if(k==0 || k==n) return 1;

if(k<0 || k>n || n<0) return 0;

return binomial_coef(n-1, k) + binomial_coef(n-1, k-1);
}

2) main procedure

clear screen;

enter integer loop:
print “enter integer” message;
test if the integer equals 0; if true then go to exit;
save integer;
initialize counter variable with 0 value;

binomial loop:
test if counter is greater than the integer value; if true then go to the enter integer loop start;
call binomial procedure (integer, counter);
print result;
increment counter variable;
go to the binomial loop start;

exit:
print “bye” message;
end;...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$125.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.