我想知道如何從Java的雙重價值中獲得10%的收益?我嘗試過研究Java中的百分比,但它有點令人困惑。從雙Java取10%
0
A
回答
0
您可以乘以0.1而不是使用百分比。
例如:
/*Your starting value*/
int x = 100
/* Your percent you want to take away*/
int y = 0.1 /*0.1 is the same as 10%*/
int z = x*y
/* A takes your starting amount and takes away 10% */
int a = x-z
/* a is your answer */
這樣做將是0.9(它由multiplys 90%)相乘的更簡單的方法。
/*Your starting number*/
int x = 100
/*What you want to take away*/
int y = 0.9
int z = x*y
這確實需要更少的代碼和eqations。
相關問題
- 1. java中雙除10
- 2. Java雙重URL讀取器?
- 3. Int64由於雙倍10^x?
- 4. 雙精度10點精度
- 5. 從Java中的樹中提取前10個值
- 6. 從例如獲取輸入:JAVA計算10×20
- 7. 獲取部分從雙
- 8. 從java中的文本文件中讀取雙精度
- 9. 從文件中的Java讀取的雙精度值
- 10. 從Java中的掃描儀讀取雙打不工作了
- 11. 我怎樣接取雙緩衝[]從Java中JNI
- 12. Oracle Forms 10/java
- 13. java的錯誤:雙不能取消
- 14. 的Java Math.exp(雙)VS StrictMath.exp(雙)
- 15. 從Java的Rhino JS/ScriptEngine - 整數,雙打?
- 16. 如何從字符串 「1000.0」 雙Java中
- 17. 從雙網卡用Java和Ubuntu
- 18. 雙向鏈表java從後面移除
- 19. 打印雙字數目爲10進制
- 20. Java雙緩衝
- 21. Java舍入(雙)
- 22. Java雙等於
- 23. Java雙鏈表
- 24. Java請求雙
- 25. Java和雙
- 26. 雙擊java
- 27. 雙鏈表 - Java
- 28. 的Java如何從字符串中提取雙人間從文本文件
- 29. Excel計數從10到10
- 30. JAVA ISBN-10編號:查找第10位
乘以0.9(即90%)? – Adam