Archive

Archive for the ‘pemrograman’ Category

Segitiga Dengan Java

class Segi3b{

public static void main(String[] args){
int n=10, m=10; // jml baris, m jml kolom
for (int i=0;i<n;i++ ) //baris
{
for (int j=0;j<m-(n-i) ;j++ ) //kolom
{
System.out.print(“*”);
}

System.out.println(); //pindah baris

}
}
}

Categories: pemrograman Tags: , ,

Segi Empat Dengan Java

class Segi4{

public static void main(String[] args){
int n=6, m=10; // jml baris, m jml kolom
for (int i=0;i<n;i++ ) // baris
{
for (int j=0;j<m ;j++ ) // kolom
{
System.out.print(“*”);
}

System.out.println();// pindah baris
}
}
}

Categories: pemrograman Tags: