well actually what i would need is to write a recursive function or a function that calls a recursive function that draws a triangle into the matrix of base = num, the function is void triangle(int num, char m[][num]), the matrix m is originally filled up with space characters, the figure must be fractal, heres what i did:
Code:
void triangle(int num, char m[][num])
{
int a, b, c;
for(a = 1; a <= num; a++) {
for(c = num-a; c>0; c--) {
printf(" ");
}
for(b = 1; b <= num; b++) {
if((pascal(a,b) % 2) == 0) {
m[a][b] = 'O';
}
printf("%2.c", m[a][b]);
}
printf("%c", '\n');
}
}
int pascal(int num, int c) // recursive function, checks the position of a number into the pascal's triangle
{
if((c == 0) || (c == num)) {
return 1;
}
else if(c > num) {
return 1;
}
else
return pascal(num-1, c-1) + pascal(num-1, c);
}
The first function checks if the position of m[a][b] into the pascal triangle is an even number, if this condition is true it draws a O character into the matrix and so on..
now that actually draws a triangle into the matrix, and it is fractal, but the previous problem remains, so im thinking that maybe i've got to come up with a new idea