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) {
  11. printRuble(10000);
  12. printRuble(12500);
  13. printRuble(10025);
  14. printRuble(10002);
  15. printRuble(12222);
  16.  
  17. }
  18.  
  19. private static void printRuble(int sum) {
  20. int kop = sum % 100;
  21. int rub = sum / 100;
  22. String format = String.format("%d.%02d", rub, kop);
  23. System.out.println(format);
  24. }
  25. }
Success #stdin #stdout 0.1s 28204KB
stdin
Standard input is empty
stdout
100.00
125.00
100.25
100.02
122.22