Expt-3
Expt-3
a. Program:(addition)
#include <stdio.h>
#include <stdlib.h>
struct Term
{
int coefficient;
int exponent;
};
struct Polynomial
{
int numTerms;
struct Term *terms;
};
void createPolynomial(struct Polynomial *poly)
{
int i;
printf("Enter the number of terms: ");
scanf("%d", &poly->numTerms);
poly->terms = (struct Term *)malloc(poly->numTerms * sizeof(struct Term));
32
31
13
Enter Polynomial 2:
12
21
32
b. Program:(multiplication)
#include <bits/stdc++.h>
using namespace std;
return start;
}
ptr = ptr->next;
}
cout << ptr->coeff << "\n";
}
// Driver Code
int main()
{
return 0;
}
Output: