Header Ads

How to print Given pyramid in C

--------------------------------------------------Program----------------------------------------------

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

}


--------------------------------------------------Output------------------------------------------------
screenshot for given above pyramid

No comments