[code] Java membuat Bintang menjadi Segitiga berurut Part. 6

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Bintang;

/**
 *
 * @author FIQI
 */
public class Bintang6 {
    public static void main (String[] args){
    int baris,m,x,y,n;
    for (int i=1;i<=7;i++){
        if (i<=4){
            for (int j=1;j<=7;j++){
                if (j<=4){
                    m=i+j;
                if (5<=m)
                    System.out.print("*");
                else
                    System.out.print(" ");
    }
            else{
            x=j-3;
            if(x<=i)
                System.out.print("*");
            else
                System.out.print(" ");
            }
          }
        }
    else
        for(int j=1;j<=7;j++){
        if(j<=4){
        y=i-3;
        if(y<=j)
            System.out.print("*");
        else
            System.out.print(" ");
        }
 else
           {
            x=j-3;
            y=i-3;
            n=x+y;
            if (n<=5)
                System.out.print("*");
            else
                System.out.print(" ");
           }
        }
    System.out.println();
}
}
}

0 komentar:

Posting Komentar

: Ayoo sharingg.. :D

Related Posts Plugin for WordPress, Blogger...

Sponsor

Banner

Ayo kita tukar - tukaran banner : my code banner :
ImagineWorld
and my friend :