Submit Your Site To The Web's Top 50 Search Engines for Free!       ExactSeek: Relevant Web Search

Visitors

Flag Counter

Total Pageviews

Thursday, November 22, 2012

Create a Triangle or Pyramid Using C

It is an exploration of the C programming How to make a triangle or pyramid with bahaca C.  
You can make this?

Error Load Image

or this

Error Load Image
or.....
Error Load Image

This is the source code
Error Load Image



  

Explanation
1. Function height();
This function is used to enter the height of triangle, of type integer

2. TriangleLeft(int n);
This function is used to make a regular triangle with align left. The algorithm,
the first for(i = 1; i <= n; i++) is used to print row, and the second for used to print colomn.

3.  TriangleLeftReserve(int n);
the inverse of the TriangleLeft function

4. TriangleRight(int n)
This function is used to make a regular triangle with align right.

5. TriangleRightReserve(int n)
the inverse of the TriangleRight function

6. EquilateralTriangle(int n)
to make Equilateral Triangle, the algorithm :
the first and second for is used to make triangle with align left, and then, the last for used to make a triangle on the right side, but the height is height-1

7. EquilateralTriangleReserve(int n)
the inverse of the EquilateralTriangle function

8. Diamond(int n)
this function used to make a diamond. Algorithm is a merger between the EquilateralTriangle function and the function EquilateralTriangleReserve

9. DiamondVoid(int n)
function is the same as the Diamond(int n) function, however, the difference is in IF conditon.
if i = 1, j = 1, and j = a, it means the star will be upper side of diamond, and
 if j = a and j = i+1, it means the star will be lower side of diamond

10. MottleDiamond(int n)
function is the same as the Diamond(int n), but, the improvisation is in if condition.

11. TriangleVoid(int n)
make a EquilateralTriangle but the fill is void

12. TriangleVoidReserve(int n)
the inverse of the TriangleVoid function

0 comments

Post a Comment

loading