Tipe Data Float dan Double

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package tipedatadanvariabelprogram2.TipeDatadanVariabel;

/**
*
* @author Jet
*/
public class Program2 {
int bilBulat1 = 115;
float bilDesimal1;
double bilDesimal2;

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new Program2 ();
}
public Program2 () {
bilDesimal1 = 7;
float hasilbagi = bilBulat1/bilDesimal1;
System.out.println(“Hasil bagi “+ bilBulat1 + “dengan” + bilDesimal1 + “adalah =” + hasilbagi);

bilDesimal2 = 8;
double hasilbagi2 = bilBulat1/bilDesimal2;
System.out.println(“Hasil bagi “+ bilBulat1 + “dengan” + bilDesimal2 + “adalah = “+ hasilbagi2);
}

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s