program for addition of two polynomials
/* program for addition of two polynomials * polynomial are stored using structure * and program uses array of structure */ #include <stdio.h> /* declare structure for polynomial */ struct poly { int coeff; int expo; }; /* declare three arrays p1, p2, p3 of type structure poly. * each polynomial can have maximum of ten terms * addition result of p1 and p2 is stored in p3 */ struct poly p1[10],p2[10],p3[10]; /* function prototypes */ int readPoly( struct poly []); int addPoly( struct poly [], struct poly [], int , int , struct poly []); void displayPoly( struct poly [], int terms); int main() { int t1,t2,t3; /* read and display first polynomial */ t1=readPoly(p1); printf( " \n First polynomial : " ); displayPoly(p1,t1); /* read and display second polynomial */ t2=readPoly(p2); printf( " \n Second polynomial : " ); displayPoly(p2,t2); /* ad...

Nice pic yar
ReplyDelete