C++: Write a program that computes and displays a full binomial expansion, such as (x+y)^n where only n is asked for by the user.
Answer-
C++ program.
#include <iostream>
#include <math.h>
using namespace std;
void expansion(int x, int y, int n) //function for calculating the
expansion.
{
int value = pow(x, n); //calculating first term of expansion
cout << value << " ";
for (int i = 1; i <= n; i++) //calculating and printing
remaining values of expansion
{
value = value * y * (n - i + 1)/(i * x);
cout << value << " ";
}
}
int main()
{
int x = 3, y = 4, n;
cout<<" Enter the value of n = "; //user input n
cin>>n;
expansion(x, y, n); //calling the function for expansion
calculation
return 0;
}
Screenshot of Program-

C++: Write a program that computes and displays a full binomial expansion, such as (x+y)^n where...
The following function computes by summing the Taylor series
expansion to n terms. Write a program to print a table of using both this function and
the exp() function from the math library, for x = 0 to 1 in steps
of 0.1. The program should ask the user what value of n to use.
(PLEASE WRITE IN PYTHON)
def taylor(x, n):
sum = 1
term = 1
for i in range(1, n):
term = term * x / i...
Write a Prolog program that computes binomial coefficient
Write a c++ program where it computes n choose k by using the formula: n(n-1)(n-2)...(n-k+1)/k!. But do not use algorithms where you can use only use integer arithmetic. How is this better than writing a program that uses the formula n!/k!(n-k)!
In C++, Write a program that it prompts to user for two integers, computes the quotient of two integers, and then displays the result. You need to do the following things in this assignment: + The main function prompts for user input and reads the two integers that the user entered. + Write a quotient function that computes the quotient of two integers and return the results. (hint: avoid integer division and divide by zero)
Problem1. Write a C program, called cos.approx.c, that computes the approximate value of cos(x) according to its Tavlor series expansion: (-1)"r2n (2n)! x2 x4x6x8x10 cos(x)-Σ 1 This series produces the exact value of cos(x) for any real number x, but contains an infinite number of terms. Obviously, a computer program can compute only a finite number of terms. Thus, you will have to truncate the infinite series in (1). Your program should be able to do so in two different...
Write a JAVA method that expands a given binomial (ax + by)n,
where integers a, b, n are user inputs. For example, if a = 2, b =
-12, n = 4 are entered the method should print or return
(2x - 12y)^4 = 16x^4 - 384x^3y + 3456x^2y^2 – 13824xy^3 +
20736y^4
Use the Pascal’s triangle method using only one 1-dim array to
calculate all binomial coefficients.
1. Write a JAVA method that expands a given binomial (ax by)",...
Using #include <stdio.h> 6) Write a program that computes X^Y (X to the power of Y). You are required to use a while loop to solve the problem. Do not use the pow function from the “math.h” library. You may hard code the variables X and Y in the beginning of your program. Hint: 5^4 =5*5*5*5
c++ Write a program that computes and displays the tuition for courses offered at the University. First, the program should ask if the student has registered for a regular course or a course with a lab component. The user can enter the letter 'C' or 'c' for lecture course only, or the letter 'L' or 'l' for a laboratory course . Write a function called Menu, which takes no input parameters and returns a char value. Your main program will...
Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user for type of employee (hourly ("h"or "H") or management ("'m" or "M") If the employee is management: . get the annual salary get the pay period (weekly ("w" or "W"), bi-weekly ("b" or "B") or monthly ("m" or e compute the gross salary for the pay period (Divide annual salary by 52 for weekly, 26 for bi-weekly, and 12 for monthly) deduct from gross...
Write a program to find Y=sin(x), where x=0,1,2,3,..., n and n is natural number and x in degree