Header Ads

Right Angle Triangle (2)

Write a program to create the following Pyramid using C program?
                      @
           @@
        @@@
 @@@@
 @@@@@

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

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

}

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

Screen shot for above pyramid

No comments