Project Report: Aim:-Theory

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Project Report

Aim:-Write a program for developing polynomial calculator and using multiplication


function, by using c language.

Theory:-Polynomial is an expression that contains more than two terms.A term made of
coefficient and exponent.
Polynomial multiplication is a process for multiplying together two or more polynomials. We
can perform polynomial multiplication by applying the distributive property to the
multiplication of polynomials.
To multiply two polynomials with each other , take the terms of first polynomial and
distribute them over the second polynomial.
Ex (a+b)(c+d)=ac+ad+bc+bd.
In C programming it can be executed by using looping methods,structures,arrays. In our
program looping statements are used.
Structure of polynomial is created.In void main user input has been taken i.e(no of
terms,degree,coefficient).For loops are used for numbers of terms in form of ( i,j ).At last else if
statements are used for product of multiplication process.
Applications:-1) For developing calculator.
2) Mostly use to find area of shapes such as circle,cylinder,cone,etc.
3) In Army field it is used for assuming the enemy target location.
4) Navy field is more concern about their proper location so with the help of the polynomial
multiplication they use to find the proper expression for locating x-coordinate and y-
coordinate.
5) In economy sector it used to calculate the net profit,stock values, total turnover etc. They are
also used to represent coast functions and they are used to interpret and forecast market
trends.Statisticians used mathematical models,which include polynomials,to analyze and
interpret data and draw conclusions.
6)Meteorology:In this field polynomials are used to create mathematical models to represent
weather patterns; these weather patterns are then analyzed to make weather predications.
Program:-
//Program for polynomial calculator for multiplication
#include<stdio.h>
struct poly
{
int degree;
int coeff;
};//End of structure definition//

void main()
{
struct poly poly1[10],poly2[10],product[100];
int noOfTerms1,noOfTerms2,count=-1;
int i,j;
printf("\t\t\t\tPolynomial Calculator\t\t\t\t\n\n");

printf("\t\t\t\t For Multiplication purpose\t\t\t\t\n\n\n");


printf("\nEnter Number Of Terms Of 1st Polynomial: ");
scanf("%d",&noOfTerms1);
for(i=0;i< noOfTerms1;i++)
{
printf("\nEnter Degree: ");
scanf("%&&d",&poly1[i].degree);
printf("\nEnter Coefficient: ");
scanf("%d",&poly1[i].coeff);
}//End of i for loop//
printf("\nEnter Number Of Terms Of 2nd Polynomial: ");
scanf("%d",&noOfTerms2);
for(i=0;i< noOfTerms2;i++)
{
printf("\nEnter Degree: ");
scanf("%d",&poly2[i].degree);
printf("\nEnter Coefficient: ");
scanf("%d",&poly2[i].coeff);
}//End of i for loop//
for(i=0;i< noOfTerms1;i++)
{
for (j=0;j< noOfTerms2;j++)
{
product[++count].degree=poly1[i].degree+poly2[j].degree;
product[count].coeff=poly1[i].coeff*poly2[j].coeff;
}//End of j for loop//
}//End of i for loop//
printf("\nThe Product Of Two Polynomials Is: \n");
for(i=0;i<=count;i++)
{
if(product[i].degree==0)
printf("%d ",product[i].coeff);
else if(product[i].degree==1)
printf("%dx ",product[i].coeff);
else
{
printf("%dx^%d ",product[i].coeff,product[i].degree);
}
if(i!=count)
printf("+ ");
}//End of i for loop//

}//End of main()//
Output:-
Conclusion:-Thus our mini project on topic polynomial multiplication in calculator is
successfully running and compiled with proper output which is shown above.

You might also like