fork 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. int sum1 = 10+5;
  13. double sum2 = 10+5.0;
  14. int quotient1 = 15/4;
  15. double quotient2 = 15/4;
  16. double quotient3 = 15/4.0;
  17. int remainder1 = 15 % 4;
  18. double remainder2 = 17.84 % 2.3;
  19.  
  20. System.out.println("10+5 is " + sum1);
  21. System.out.println("10+5.0 is " + sum2);
  22. System.out.println("15/4 is " + quotient1);
  23. System.out.println("15/4 is " + quotient2);
  24. System.out.println("15/4.0 is " + quotient3);
  25. System.out.println("15 % 4 is " + remainder1);
  26. System.out.println("17.84 % 2.3 is " + remainder2);
  27. }
  28. }
Success #stdin #stdout 0.17s 57820KB
stdin
Standard input is empty
stdout
10+5 is 15
10+5.0 is 15.0
15/4 is 3
15/4 is 3.0
15/4.0 is 3.75
15 % 4 is 3
17.84 % 2.3 is 1.740000000000001