获得多项第一位小数 [英] Getting the first decimal place of a number
本文介绍了获得多项第一位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有例如数: 2.4444444
。我需要点后,第一个数字 - 在我的情况下,它是 4
。如何实现呢?
I have a number for example: 2.4444444
. I need to get first digit after the dot -- in my case it's 4
. How to implement it?
推荐答案
如何
( (int)(floor( fabs( num ) * 10 ) ) ) % 10
这篇关于获得多项第一位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文