Program Number Pattern Using Java


Hello world! Long time no see ya hahaha :D
So, what am I doin' right now ?

In this post, I'll write how to make a number pattern using Java.
Hmmm please don't be serious X(
I just want to do something that 'funny' for me. Haha. (?)

Yaaap. Here we go! X)



public class NumberPattern { 
public static void main(String arg[])

int ck = 0, c = 2; 
while (c > 0)

if (ck == 0)

for (int i = 1; i <= 5; i++) 

for (int j = 1; j <= i; j++) 

System.out.print(j); 

System.out.println(); 

ck++; 
}
else 

for (int i = 1, r = 5 - 1; i <= 5 - 1; i++, r--)

for (int j = 1; j <= r; j++)

System.out.print(j); 

System.out.println();
}

c--;


}

PS: Me using notepad++, but if you using something like that (maybe Netbeans or etc), it's gonna be fine.

Now, lemme give you my screenshot, so you can see like what I'm typing this code.

And....THIS IS IT!


Horay! We did it! \(^o^)/
And yes! you can modification this code to be something new different.
Thank you! XOXO

Comments

Post a Comment

Popular posts from this blog