Polynomial Manipulation
Polynomial Manipulation
else
{
struct node *add_node(struct node *start, int n, ptr = start;
int c) while(ptr -> next != NULL)
ptr = ptr -> next;
{
new_node = (struct node *)malloc(sizeof(struct node));
struct node *ptr, *new_node;
new_node -> num = n;
if(start == NULL) new_node -> coeff = c;
{ new_node -> next = NULL;
new_node = (struct node ptr -> next = new_node;
*)malloc(sizeof(struct node)); }
new_node -> num = n; return start;
new_node -> coeff = c; }
new_node -> next = NULL;
start = new_node;
}
struct node *mul_poly(struct node *start1, struct node *start2,
MULTIPLY TWO POLYNOMIALS struct node *start5)
{
struct node *ptr1, *ptr2;
int res1, res2;
ptr1 = start1,
ptr2 = start2;
while(ptr1!=null)
{
while(ptr2!=null)
{
res1=ptr1->num*ptr2->num;
res2=ptr1->coeff+ptr2->coeff;
start5=add_node(start5,res1,res2);
ptr2=ptr2->next;
}
ptr1=ptr1->next;
}
return start5;
}
DISPLAY POLYNOMIALS