Computer Science, asked by samsoniss61, 6 months ago

write a programme in c language for additional of two polynomials using pointer​

Answers

Answered by 2006ujjwal07
2

Answer:

if you want answer first follow me india

Explanation:

follow me india ok please

Answered by PrincessTeja
4

Write a program in ‘C’ for the addition of two polynomials. Use Arrays and Structures. 10m Dec2006

#include<stdio.h>

void main()

{

int poly1[6][2],poly2[6][2],term1,term2,match,proceed,i,j;

printf(“Enter the number of terms in first polynomial : “);

scanf(“%d”,&term1);

printf(“Enter the number of terms in second polynomial : “);

scanf(“%d”,&term2);

printf(“Enter the coeff and expo of the first polynomial:\n”);

for(i=0;i<term1;i++)

{

scanf(“%d %d”,&poly1[i][0],&poly1[i][1]);

}

printf(“Enter the coeff and expo of the second polynomial:\n”);

for(i=0;i<term2;i++)

{

scanf(“%d %d”,&poly2[i][0],&poly2[i][1]);

}

printf(“The resultant polynomial after addition :\n”);

for(i=0;i<term1;i++)

{

match=0;

for(j=0;j<term2;j++)

{

if(match==0)

if(poly1[i][1]==poly2[j][1])

{

printf(“%d %d\n”,(poly1[i][0]+poly2[j][0]), poly1[i][1]);

match=1;

}

}

}

for(i=0;i<term1;i++)

{

proceed=1;

for(j=0;j<term2;j++)

{

if(proceed==1)

if(poly1[i][1]!=poly2[j][1])

proceed=1;

else

proceed=0;

}

if(proceed==1)

printf(“%d %d\n”,poly1[i][0],poly1[i][1]);

}

for(i=0;i<term2;i++)

{

proceed=1;

for(j=0;j<term1;j++)

{

if(proceed==1)

if(poly2[i][1]!=poly1[j][1])

proceed=1;

else

proceed=0;

}

if(proceed==1)

printf(“%d %d”,poly2[i][0],poly2[i][1]);

}

getch();

}

Attachments:
Similar questions
Science, 6 months ago