1. ## Polynomial Multiplication program

Code:
```#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct poly_node
{
int coeff;
int power;
struct poly_node *next;
}polynode;
polynode* create(polynode*,int);

void polymulti(polynode*,polynode*);
void display(polynode *,polynode *,polynode*);
int main()
{
int n1,n2;
printf("\n Enter Elements in first List \n");
printf("Enter no. of elements of 1st list = ");
scanf("%d",&n1);
printf("Enter coefficient of head1 = ");
printf("Enter power of head1 = ");

printf("\n Enter Elements in Second List \n");
printf("Enter no. of elements of 2nd list = ");
scanf("%d",&n2);
printf("Enter coefficient of head2 = ");
printf("Enter power of head2 = ");
return 0;
}
{
polynode *new,*q;
int i;
for(i=1;i<n;i++)
{
new=(polynode*)malloc(sizeof(polynode));
printf("Enter coefficient = ");
scanf("%d",&new->coeff);
printf("Enter power = ");
scanf("%d",&new->power);
new->next=NULL;
q->next=new;
q=new;
}
}
{
polynode *p,*q,*result,*s;
result=NULL;
int newcoeff,newpower,i;

while(p!=NULL)
{
while(q!=NULL)
{
newcoeff=(p->coeff)*(q->coeff);
newpower=(p->power)+(q->power);
s=(polynode*)malloc(sizeof(polynode));
s->coeff=newcoeff;
s->power=newpower;
s->next=NULL;
if(result==NULL)
result=s;
else
result->next=s;
q=q->next;
}
p=p->next;
}
}
{
polynode *p;
printf("\n PRINTING THE FIRST LIST : \n");
while(p!=NULL)
{
printf("%d--%d\t",p->coeff,p->power);
p=p->next;
}
printf("\n PRINTING THE SECOND LIST : \n");
while(p!=NULL)
{
printf("%d--%d\t",p->coeff,p->power);
p=p->next;
}
printf("\n PRINTING THE RESULTANT LIST : \n");
p=result;
while(p!=NULL)
{
printf("%d--%d\t",p->coeff,p->power);
p=p->next;
}
}```

2. Suppose the 1st list is 3--2 5--2 2--0 and the second list is 9--2 4--1 3--0, then this code prints the output as follows :
27--4 9--2

3. Consider something like this, to cut down on the copy/pasting of code.
Code:
```int main ( ) {
print(result);
destroy(result);
return 0;
}
polynode *create ( ) {
polynode *result = NULL;
printf("How many nodes");
for ( i = 0 ; i < n ; i++ ) {
printf("Input power and coefficient");
result = append(result,power,coefficient);
}
return result;
}
polynode *append ( polynode *head, int power, int coeff ) {
// allocate new node