Triangle Pattern in C

Hello, welcome back to Potato Techie. On this occasion, I will share how to create a triangle pattern in the C language. previously I had been discussing how to make the Left Side Right-Triangle Pattern.

For Triangle Pattern algorithm, you can look at snippet below.

So what this code doing? Well, I do separate triangle into three part : left, mid, and right.

First, the left side (line 11 to 17) is to print a half-left of triangle. Second, the mid side (line 19 to 22) is to print x to middle. Last, the right size (line 25 to 29) is to print a half-right of triangle. For more details, you can see in the comments section at gist github - Triangle Pattern

Well, you don't have to follow this algorithm. It's better for you to brainstorming how to write some pattern algorithm with your own style. So, that's it, I hope this post can help you to learn how to write a pattern. Any suggestion, feel free to write in comments and don't forget to share this to your friends.
Share on Google Plus

About Potato Techie

Love to programming, learn new things, and sharing.
    Blogger Comment

0 comments:

Post a Comment