Select Menu

Search This Blog

Populer Posts Hari ini

Popular Posts

Powered by Blogger.

Lorem 1

adsense

" });

Circle Gallery

" });

News

" });
» » » Source Code Pembulatan bilangan desimal dengan Bahasa Java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ldecimalformat;

import java.text.DecimalFormat;

/**
 *
 * @author andi m
 */
public class LDecimalFormat {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        DecimalFormat C=new DecimalFormat("0.00");
        double A=6,B=9;
        double ans=A/B;
       
        //Sebelum pembulatan
        System.out.println(ans);
        //setelah pembulatan
        System.out.println(C.format(ans));
    }
   
}

About andi

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply