1. ## a diamond

We have to create a diamond that is centered on the screen using this code that creates a triangle. My thought process has been to use 4 right triangles to create the diamond. What im stuck on is trying to make the triangle increase in the opposite direction. Is this the way to go or is there a better way? thx for any advice.

#include<ctype.h>
#include<stdio.h>
#define N 33
void repeat(char, int);

int main(void)
{
char c = 'X';
int i;
for (i = 1;i <= N; i+=2) {
repeat(c, i);
putchar('\n');

}

}

void repeat(char c, int how_many)
{
int i;

for (i = 1; i <= how_many; ++i)
putchar(c);
}

2. > for (i = 1;i <= N; i+=2) {
Perhaps
for (i = N;i >= 1; i-=2) {

3. > for (i = 1;i <= N; i+=2) {
Perhaps
for (i = N;i >= 1; i-=2) {

right, but im stuck on trying to get the triangles to go in the opposite direction so as to complete the diamond. so far i have the right half but how could i mirror this?

4. Start by printing N-i spaces on a line, followed by i 'X's

5. I don't understand what you mean by
N-i spaces on a line" ?

6. nm..got it