Lab
Test 2
1.
Use the implementation suggested in assignment 2. Write a function
P_output(int A[ ], int d) to print out a polynomial A of degree d, where zero
coefficients are skipped. For example, the above example should be printed as
2*x**9 + 14*x**6 – 2*x + 99
2.
Write a function P_add(int A[ ], int B[ ], int C[ ]) to add polynomials A
and B, and store the result in C. In other words, compute C = A+B.
3.
Write a function P_multiply(int A[ ], int B[ ], int C[ ]) to compute C = A*B.
Note that the maximum degree may be as large as 18.
Similar
implementation can be used to store very large integers. For example, a
19digit integer 9876543210987654321 can be store in an array as follows:
A: 
1 
2 
3 
4 
5 
6 
7 
8 
9 
0 
1 
2 
3 
4 
5 
6 
7 
8 
9 

0 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
4.
Write a function N_output(int A[ ], int d) to print out such a large
number, where leading zeros should not be printed.
5.
Write a function N_add(int A[ ], int B[ ], int C[ ]) to compute C = A+B
Copy this program template as your starting point. Do not change
the main program; write the five functions only.