Inverted Asterisk Triangle

How can I re-position this triangle to the left???
So this is my code:

#include<stdio.h>
#include<conio.h>

void main()
clrscr();
int x,y;
for(x=1;x<=5;x++)
{
for(y=1;y<=x;y++)
printf(" *");
printf("\n);
}
getch();
}

Its output is:
*
* *
* * *
* * * *
* * * * *
But I want it to be like this:
! ! ! ! ! *
! ! ! ! * *
! ! ! * * *
! ! * * * *
! * * * * *
I will thankfully appreciates your response. :)
This is my first time to post here..haha :) Pls. kindly understand my grammar :)
This is written in C++, but if you just take it to be all the same except printf() is replaced by cout <<... It doesn't use a triangle, but it demonstrates how to space things away from the edge as you asked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

int main()
{
    int x = 0, y = 9, z = 0;
    while(y > 0)
    {
        z = 0;
        while(z < y)
        {
            cout << " ";
            ++z;
        }
        cout << "*\n";
        --y;
    }
    return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

int main()
{
    for (int i = 0; i < 5; i++)
    {
        for (int j = 3 - i; j >= 0; j--)
            std::cout << "  ";

        for (int j = 0; j < i + 1; j++)
            std::cout << "* ";

        std::cout << std::endl;
    }

    return 0;
}
Topic archived. No new replies allowed.