C Program to Print 1-212-32123 Triangle (Pyramid) Pattern

#include<stdio.h>

int main()
{
    int i,j,row;

    printf("Enter number of rows: ");
    scanf("%d",&row);

    for(i=1;i<=row;i++)
    {
        for(j=1;j<=row-i;j++)
        {
            printf(" ");
        }

        for(j=i;j>=1;j--)
        {
            printf("%d", j);
        }

        for(j=2;j<=i;j++)
        {
            printf("%d", j);
        }
        printf("\n");
    }

    return 0;
}

Output 

Enter number of rows: 8
       1
      212
     32123
    4321234
   543212345
  65432123456
 7654321234567
876543212345678

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.