Findryan

Untitled

Nov 5th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PembagianDesimal
  4. {
  5. public static void main(String[]args)
  6. {
  7. float a,b,c;
  8. Scanner I_Integer = new Scanner(System.in);
  9. System.out.print("Masukan Bilangan\n");
  10. a = I_Integer.nextInt();
  11. b = I_Integer.nextInt();
  12. c= a/b;
  13. System.out.println("a/b= "+ c); // cetak biasa
  14. System.out.println(String.format("%.2f", c)); // cetak dengan format string
  15. System.out.printf("%.2f",c);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment