Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PembagianDesimal
- {
- public static void main(String[]args)
- {
- float a,b,c;
- Scanner I_Integer = new Scanner(System.in);
- System.out.print("Masukan Bilangan\n");
- a = I_Integer.nextInt();
- b = I_Integer.nextInt();
- c= a/b;
- System.out.println("a/b= "+ c); // cetak biasa
- System.out.println(String.format("%.2f", c)); // cetak dengan format string
- System.out.printf("%.2f",c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment