cute倩影O_o
2016-11-08 21:26
怎么将普通数字转换为科学计数法,谢谢
public static void parseSciNot(double num, double base, int index) {
base = num;
index = 0;
if (num >= 1) {
while (base >= 10) {
base = base / 10;
index ++;
}
}
else {
while (base < 1) {
base = base * 10;
index --;
}
}
System.out.println("The scientific notation of " + num + " is: " + base + "*10^(" + index + ")");
}
例如 3000=3*10的三次方。0.003=3*10的负三次方
Java入门第三季
409792 学习 · 4340 问题
相似问题