Output:
Click Here For Java Online Compiler
Solution:
*** Whole and Fractional Parts In A Double Original number is : 12.368 Integral part : 12.0 Fractional part : 0.3680000000000003
Click Here For Java Online Compiler
Solution:
class WholeFractionalOfDouble { public static void main(String[] args) { double anyNumber = 12.368; double fractional_part = anyNumber % 1; double integral_part = anyNumber - fractional_part; System.out.println("*** Whole and Fractional Parts In A Double" + "\n"); System.out.println("Original number is : " + anyNumber + "\n"); System.out.println("Integral part : " + integral_part); System.out.println("Fractional part : " + fractional_part); } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon