Google Translate

Perulangan Bintang Pemograman Java 2

import java.io.Console;
public class pyramidtengah {

public static void main (String[] args){
int i;
int j;


System.out.print("tingggi : ");

String in=System.console().readLine();
int t = Integer.parseInt(in);
System.out.println();

    for (i=1; i<= t; i++){
        for (j=1; j<=t-i; j++){
        System.out.print(' ');
        }
       
        for (j=1; j<=i; j++){
        System.out.print('*');
        }
       
        for (j=1; j<=i-1; j++){
        System.out.print('*');
        }

System.out.println();
}
}
}
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© ILMU TEKNIK INFORMATIKA
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top