home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / PLYMUL.C < prev    next >
Encoding:
Text File  |  1984-06-21  |  573 b   |  32 lines

  1.    plymul(a,b,nda,ndb,c,ndc)
  2.  
  3.  
  4.       /*this function multiplies any two polynomials of the same*/
  5.       /*single variable where both polynomials are of the form*/
  6.       /*a(1)*x**nda + a(2)*x**(nda-1) + ... + a(nda)*x + a(nda+1).*/
  7.  
  8.      int nda,ndb,*ndc;
  9.      float a[],b[],c[];
  10.  
  11.    {
  12.       int i,j,ipj,n;
  13.  
  14.       *ndc = nda + ndb;
  15.       n = *ndc;
  16.  
  17.       for(i = 0;i <=n; i++)
  18.          c[i] = 0.0;
  19.  
  20.       for(i = 0;i <= nda; i++)
  21.        for(j = 0; j <= ndb; j++)
  22.        {
  23.         ipj = i + j;
  24.         c[ipj] += a[i]*b[j];
  25.        }
  26.    }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.