代码如下:
?
|
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
|
import java.awt.image.databufferbyte;
import java.text.decimalformat;
public class duioxiangshicheng {
static void poiay(double[] a,int m,double[] b,int n,double[] r,int k){
int i,j;
for(i=0;i<k;i++){
r[i]=0.0;
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
r[i+j]=a[i]+b[j];
}
}
}
public static void main(string[] args) {
int i;
double a[]={-4.0,5.0,2.0,-1.0,3.0,2.0};
double b[]={-3.0,-2.0,1.0,3.0};
double[] r=new double[9];
decimalformat df=new decimalformat("0.0000000e000");
poiay(a,6,b,4,r,9);
system.out.println("多项式a*b的结果各项系数:");
for(i=0;i<9;i++){
system.out.println("r("+i+")="+df.format(r[i]));
}
}
}
|
?
|
1
2
3
4
5
6
7
8
9
10
|
/*输出多项式a*b的结果各项系数:
r(0)=-7.0000000e000
r(1)=2.0000000e000
r(2)=-1.0000000e000
r(3)=-4.0000000e000
r(4)=0.0000000e000
r(5)=-1.0000000e000
r(6)=0.0000000e000
r(7)=3.0000000e000
r(8)=5.0000000e000*/
|
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对快网idc的支持。如果你想了解更多相关内容请查看下面相关链接
原文链接:https://blog.csdn.net/Czhenya/article/details/77610335
相关文章
猜你喜欢

