如何开根号 编程实现


public static double sqrt(double a)
{
double x1= 0.0;
double x2 =a/2;

while(x1!=x2)
{
x1=x2;
System.out.println(a/x1);
x2=(x1+a/x1)/2;
}
return x1;
}

6×9的的方格中,起点的左下角,终点在右上角,从起点到终点,只能从下向上,从左向右走,问一共有多少种不同的走法。
A.  4200
B.   5005
C.  1005
D.  以上都不正确

public static int func(int m, int n){

int sum =0;

if(m==0 || n==0){
sum+=1;
}else if(m==1 || n==1){
sum+=m+n;
}else{
for(int i=n;i>=0;i--){
sum+=func(m-1,i);
}
}

return sum;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM