Topic: 开方问题?

  Print this page

1.开方问题? Copy to clipboard
Posted by: czg4444
Posted on: 2006-09-10 16:51


class A11{
// public static void main(String args[])
public static void main(String args[])
{
int x=10;
int b;
for(b=x;x==b/b;b++)
System.out.println("x开方"+b);
}}

请问我的开方程序有什么问题???
就是没有运算结果????
请高人指教!!!!

2.Re:开方问题?????? [Re: czg4444] Copy to clipboard
Posted by: leange
Posted on: 2006-09-10 19:10

没看懂LZ想表示什么???

3.Re:开方问题? [Re: czg4444] Copy to clipboard
Posted by: lisliefor
Posted on: 2006-09-11 10:31

同楼上,看不明白,也许是很高明的算法。 Smile
没运算结果显示,是因为根本就没进循环,首先,b=10, b/b=10/10=1, 而x的初始值为10,不满足条件。

求开放的算法,你可以查一下API,MATH类下有静态的算法。

4.Re:开方问题? [Re: czg4444] Copy to clipboard
Posted by: wwhui
Posted on: 2006-09-11 23:21

这个程序根本就没有实现循环,因为它不满足循环条件。所以你这个程序就没有输出结果让你看到。程序是没有错误,但不能实现开方。你可以调用MATH里面的方法。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923