Printing Inverted Floyd Triangle

Written by

Namrata Jangid

Printing inverted Floyd Triangle:

With special characters

The code:

#include <stdio.h>

int  main()

{

int  i, j, n;

printf("Enter number of rows: ");

scanf("%d", & amp; n);

printf("\n");

for (i = n; i & gt; = 1; --i)

{

  for (j = 1; j & lt; = i; ++j)

  {

     printf("* ");

  }

  printf("\n");

}

return  0;

}

The output for the above code is:

Enter number of rows:  7





With numbers

The code:

#include <stdio.h>

int  main()

{

int  i, j, n;

printf("Enter number of rows: ");

scanf("%d", & amp; n);

printf("\n");

for (i = n; i & gt; = 1; --i)

{

  for (j = 1; j & lt; = i; ++j)

  {

     printf("%d ", j);

  }

  printf("\n");

}

return  0;

}

The output for the above code is:

Enter number of rows:  7

1 2 3 4 5 6 7

1 2 3 4 5 6

1 2 3 4 5

1 2 3 4

1 2 3

1 2

1

Printing Inverted Floyd Triangle