harmoni.java


public class harmoni
{
public static void main(String[] args)
{
int s,i=1;
double h,n;
String harmoni;
h = 1;
n = 1;
s = 10;
harmoni = “harmoni : ” +i;
for ( i = 2; i <= s ; i++)
{
++n;
h = h + (1/n);
harmoni = harmoni + “, 1/” + i;
}
harmoni = harmoni + ” = ” + h;
System.out.println(harmoni);
}
}

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 )

Gambar Twitter

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

Foto Facebook

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

Foto Google+

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

Connecting to %s