Jumat, 15 November 2013

Program Perulangan 3 Pada JAVA

 import java.util.*;
public class segitiga3 {

    public static void main(String[] args) {
  
        Scanner input = new Scanner(System.in);
        int a,b,c,d,e;
  
        System.out.print("Masukan Angka : ");
        a = input.nextInt();
  
        e=a;
        for(b=1;b<=a;b++)
        {
             for(d=e;d>=1;d--)
             {
                 System.out.print(" "); //
             }
             for(c=1;c<=b;c++)
             {
                 System.out.print("* ");
             }
             e=e-1;
             System.out.println("");
        }   
        System.out.println("\n\n");              
    }
      
}

1 komentar:

Please Leave Your Comment :)