C Program to Print a pyramid string triangle

#include <stdio.h>
#include <string.h>
int main()
{
         int i,j,length;
         char arr[] = "Programming";
         length = strlen(arr);
         for (i = length; i >= 0; i--)
        {
            printf("\n");
           for (j = 0; j< i; j++)
          {
                  printf("%c",arr[j]);
          }
       }
     return 0;
}
Output:
Programming
Programmin
Programmi
Programm
Program
Progra
Progr
Prog
Pro
Pr
P

1 comment:

  1. Nice tutorial. Thanks for sharing the valuable info about c Training. it’s really helpful. Who want to learn c language this blog most helpful. Keep sharing on updated tutorials…..

    ReplyDelete