Tuesday, September 6, 2016

Tags

PROGRAM TO ADD TWO POLYNOMIALS :
#include<iostream>
using namespace std;
main()
{
int a[100],b[100],c[100],n;
cout<<"enter the max power of polynomial";
cin>>n;
n++;
cout<<"enter the coefficents and constants";
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
cin>>b[i];
for(int i=0;i<n;i++)
c[i]=a[i]+b[i];
cout<<"coefficents and constants of result polynomial  ";
for(int i=0;i<n;i++)
cout<<c[i]<<"x^"<<n<<"+";

}