tugas java



st1\:*{behavior:url(#ieooui) }
<!– /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:””; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:”Times New Roman”; mso-fareast-font-family:”Times New Roman”;} @page Section1 {size:8.5in 13.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} –>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:””;
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:”Times New Roman”;
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}

NAMA :VASKO EDO GULTOM

NIM : 071402009

/* @(#)Bilangan.java

/*@#nama:vasko edo gultom

/*@#nim :071402009

/*

public class Bilangan

{

public static void Bilangan()

{

int i, j;

for(i=1; i<6; i++)

{

if(i%2==0)

for(j=1; j<7; j++)

System.out.print(“- “);

else

for(j=1; j<7; j++)

System.out.print(j + ” “);

System.out.println(“”);

}

}

public static void main(String args[])

{

Bilangan ();

}

}

/* @(#)HalfPyramid.java

* @Nama = vasko edo gultom

* @N I M = 071402009

*/

public class HalfPyramid

{

public static void main(String args[] )

{

Pyramid();

}

public static void Pyramid()

{

int i, j;

for(i=6; i>0; i–)

{ for(j=1; j<i; j++)

System.out.print(j + ” “);

System.out.println(“”);

}

}

}

/*@(#)FPB.java

* @Nama = vasko edo gultom

* @N I M = 071402009

*/

import java.io.*;

public class FPB

{

public static void main(String args[]) throws IOException

{

int a, b, c;

String d1, d2;

System.out.println(“Program Mencari Faktor Persekutuan Terbesar.”);

System.out.println(“Berikan dua buah bilangan : “);

d1 = stdin.readLine();

d2 = stdin.readLine();

a = Integer.parseInt(d1);

b = Integer.parseInt(d2);

c = Faktor (a,b);

System.out.println(“FPB dari bilangan ” + a + ” dan bilangan ” + b + ” adalah ” + c );

}

public static int Faktor(int num1, int num2)

{

int temp;

do

{

temp = num1 % num2;

num1 = num2;

num2 = temp;

}

while (temp > 0);

return num1;

}

}

One thought on “tugas java

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

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