通过除以两个int得到一个double

通过除以两个int得到一个double

本文介绍了通过除以两个int得到一个double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能看起来非常基本......几乎羞于问道。



但我希望通过将整数除以另一个整数得到一个双精度数。



我想这样做0.8



但是我注意到它没有返回4/5我只试过:


p $ p>双倍得分;
得分= 4/5 * 100;
解决方案



this may seemed very basic...almost ashamed to asked.

But I want to get a double by dividing an integer by another integer.

I want to 0.8 by doing this

but I notice it is not returning the 4/5 only whole numbers.

What I have tried:

double score;
             score = 4/5*100;
解决方案



这篇关于通过除以两个int得到一个double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:31