hi. im trying to create a program in which the user inputs the character and the level. this would output to a triangle and an inverted triangle. i have already figured out the triangle but i cant seem to get the right output for the inverted triangle
#include <stdio.h>
#include <conio.h>
void main()
{
int n;
int m;
int o;
char p;
clrscr();
printf("Enter a symbol: ");
scanf("%c", &p);
printf("Enter levels for traingles: ");
scanf("%d", &n);
printf("\nNormal triangle:\n");
for (m=1; m<=n; m++)
{
printf("\n");
for (o=1; o<=m; o++)
{
printf("%c", p);
}
}
printf("\n\nInverted triangle:\n");
for (m=n; m>0; m--)
{
printf("\n");
for (o=n; o>0; o--)
{
printf("%c", p);
}
}
getch();
}
an example output of the 2nd loop is:
entered character: #
entered level: 6
ouput:
######
######
######
######
######
######
pls help. tnx.