C Program to print inverse triangle of Numbers in c, inverted triangle in C, invert right triangle in C

C Program to print inverse triangle of Numbers in c, inverted triangle in C, invert right triangle in C


1 2 3 4 5 

  1 2 3 4 

     1 2 3

        1 2 

           1





#include
 
main()
{
   int n, c, k, space;
 
   scanf("%d", &n);
 
   space = 0;
 
   for ( k = n ; k >= 1 ; k-- )
   {
       for ( c = 1 ; c <= space ; c++ )
       printf(" ");
 
       space++;
 
       for ( c = 1 ; c <= k ; c++)
          printf("%d", c);
 
       printf("\n");
   }
 
   return 0;
}



OUTPUT : 

12345
 1234
  123
   12
    1

2 comments:

  1. C++ Program to Print Triangle of Stars

    Print triangle of stars is depend of two concept, first you need outer loop for line break and inner loop for increment and decrements.

    ReplyDelete