Source Code :
public class Segitiga2{
public static void main(String[]args){
int n=15;
int a,b;
String tampil = "";
for(int i=1;i<=n;i+=2){
for(a=n;a>i;a--){
tampil +=" ";
}
for (b=1;b<=i;b++){
tampil +="* ";
}
tampil +="\n";
}
System.out.print(tampil);
}
}
Output :
Source Code :
public class SegitigaSiku{
public static void main(String[]args){
int n=15;
int a;
String tampil = "";
for(int i=1;i<=n;i++){
for(a=1;a<=i;a++){
tampil +="* ";
}
tampil +="\n";
}
System.out.print(tampil);
}
}
Output :
1 komentar:
order segitiga bolong dong ..
Posting Komentar