-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolynomial.c
41 lines (37 loc) · 907 Bytes
/
polynomial.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#define max 10
void main()
{
int arr1[max],arr2[max],deg;
int i;
printf("\nEnter the Highest Degree for the Polynomials (max. 10): \n");
scanf("%d", °);
//first polynomial
printf("\nWrite down the Elemnts for the First Polynomial: \n");
for (i=deg; i>=0; i--)
{
printf("Enter the Coefficient of x^%d:\t", i);
scanf("%d", &arr1[i]);
}
//second polynomial
printf("\nWrite down the Elemnts for the Second Polynomial:\n");
for (i = deg; i >= 0; i--)
{
printf("Enter the Coefficient of x^%d:\t", i);
scanf("%d", &arr2[i]);
}
printf("The Final Polynomial: ");
//displaying the final polynomial
for(i=deg;i>=0;i--)
{
if(i!=0)
{
printf("%dx^%d + ",arr1[i] + arr2[i],i);
}
else
{
continue;
}
}
printf("0");
}