划分问题 [英] division problems
本文介绍了划分问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
Why does (360 / 24) / 60 = 0 … in Java
这行代码:
System.out.println ("array[j], "+array[j]+", divided by sum, "+sum+", equals: array[j]/sum: "+ array[j]/sum) ;
在这一行文字中是
array [j],21,除以总和100,等于:array [j]/sum:0
array[j], 21, divided by sum, 100, equals: array[j]/sum: 0
为什么要这样做? (一切正确,答案是0.21)
why is it doing this? (everything is right eccept that the answer should be .21)
推荐答案
您确定您的数组不是整数吗?
Are you sure that your array is not integer ?
如果是,请尝试使用double.
if it's, try using double.
这篇关于划分问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文