Sunday, October 16, 2011

Pattern {Reverse Floyd Triangle}

#include<stdio.h>
#include<conio.h>
void main()
{
   int n, c, k, space;
   clrscr();
   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");
   }
   getch();
}


12345
1234
123
12
1

No comments:

Post a Comment