Header Ads

Arrow Head Shape using Integers

Write a program to create the following Pyramid using C program?
        1
12
123
1234
 12345
1234
123
12
1



******************************Program*************************

#include<stdio.h>
#include<conio.h>
main()
{
    int r,c,n,i;
    printf("Enter the numbers of row: ");
    scanf("%d",&n);
    for(r=1;r<=n;r++)
    {
        i=1;
        for(c=r;c>=1;c--)
        {
            printf("%d",i);
            i++;
        }
        printf("\n");
    }
    for(r=1;r<=n;r++)
    {
        i=1;
        for(c=(n-r);c>=1;c--)
        {
            printf("%d",i);
            i++;
        }
        printf("\n");
    }
    getch();

}


******************************Output**************************

screen shot for 123 sequence arrow head shape

No comments