Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想分别打印双数的实部和小数部分,而不使用字符串或数组的概念?我不知道如何使用 printf() 只打印小数部分。
输入 1:13.31432 输出 1:13 31432
输入 2:15.36 输出 2:15 36
我可以打印实数部分,但不能打印小数部分。
System.out.println((long)input); //Prints real part System.out.println(input - (long)input); //Prints decimal part