fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. double numero = 10.10;
  13. double resto = numero - Math.floor(numero);
  14. System.out.println("tem parte decimal: " + (resto != 0f));
  15.  
  16. numero = 1f / 3f;
  17. resto = numero - Math.floor(numero);
  18. System.out.println("tem parte decimal: " + (resto != 0f));
  19.  
  20. numero = 25f / 5f;
  21. resto = numero - Math.floor(numero);
  22. System.out.println("tem parte decimal: " + (resto != 0f));
  23.  
  24. numero = -Math.PI;
  25. resto = numero - Math.floor(numero);
  26. System.out.println("tem parte decimal: " + (resto != 0f));
  27.  
  28. }
  29. }
Success #stdin #stdout 0.08s 27688KB
stdin
Standard input is empty
stdout
tem parte decimal: true
tem parte decimal: true
tem parte decimal: false
tem parte decimal: true