#include <stdio.h>
{
int maxDegree = (d1 > d2) ? d1 : d2;
{
result[i] = p1[i] + p2[i];
}
}
{
int d1, d2;
printf("Enter the degree of the first polynomial: ");
scanf("%d", &d1);
printf("Enter the coefficients of the first polynomial:\n");
for (int i = 0; i <= d1; i++)
{
scanf("%d", &p1[i]);
}
scanf("%d", &d2);
printf("Enter the coefficients of the second polynomial:\n");
for (int i = 0; i <= d2; i++)
{
scanf("%d", &p2[i]);
}
addPolynomials(p1, p2, result, d1, d2);
for (int i = 0; i <= (d1 > d2 ? d1 : d2); i++)
{
printf("%d ", result[i]);
}
printf("\n");
}
No comments:
Post a Comment