void Triangle(int s)
{
int i = 0;
while (s > 0)
{
for (i = 0; i < s; i++)
{
printf("*");
}
printf("\n");
s = s - 1;
}
}
/* Print a Triangle of Stars on it's base
Input: a positive integer
Output: an n-sized triangle */
void TriangleTwo(int t)
{
int i = 0;
int x = 0;
int y = 1;
int counter = 0;
while (counter < t)
{
x = t - (t - y);
for (i = 0; i < x; i++)
{
printf("*");
}
printf("\n");
y++;
counter++;
}
}
No comments:
Post a Comment