Header Ads

Arrow head shape using Integer in row shape

Write a program to create the following Pyramid using C program?
        1
22
333
4444
55555
666666
55555
4444
333
22
1

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

#include<stdio.h>
#include<conio.h>
main()
{
    int x,y,n,i;
    printf("Enter the number ");
    scanf("%d",&n);
    for(x=1;x<=n;x++)
    {
        for(y=1;y<=x;y++)
        {
            printf("%d",x);
        }
        printf("\n");
    }
    i=1;
    for(x=n-1;x>=1;x--)
    {
        for(y=1;y<=n-i;y++)
        {
            printf("%d",x);
        }
        i++;
        printf("\n");
    }
    getch();
}


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

Screen shot for arrow head shape using integer in  row sequence

1 comment:

  1. Thanks for the programs. They are really useful

    ReplyDelete