How to print equivalent triangle with * ?

CODE




How to print equivalent triangle with * ?
int main()
{
    int i,j,k;
    for(i=4;i>=1;i--)
    {
        for(j=1;j<=i-1;j++)
        {
            printf(" ");
        }
        for(k=1;k<=4-i+1;k++)
        {
            printf("* ");
        }
        printf("\n");
    }
}

Output:
   *
  * *
 * * *
* * * *

How to print equivalent triangle with * ? How to print equivalent triangle with * ? Reviewed by Unknown on December 16, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.