Polynomial Addition Using LL
Polynomial Addition Using LL
h>
#include <stdlib.h>
struct node {
float coeff;
int expo;
struct node* link;
};
while(ptr1!=NULL)
{
head3 = insert(head3, ptr1->coeff, ptr1->expo);
ptr1 = ptr1->link;
}
while(ptr2!=NULL)
{
head3 = insert(head3, ptr2->coeff, ptr2->expo);
ptr2 = ptr2->link;
}
printf("Added polynomial is: ");
print(head3);
}
int main()
{
struct node* head1 = NULL;
struct node* head2 = NULL;
printf("Enter the First polynomial\n ");
head1 = create(head1);
printf("Enter the second polynomial\n ");
head2 = create(head2);
polyAdd(head1, head2);
return 0;