• There are many pattern programs are written by programmers for practice purposes.
  • The pyramid # pattern in C is one of them.

/* This is Pattern program using # in C */
#include <stdio.h>
/* Main function starts from here*/
int main()
{
    int i, j, rows;

/* This statement will numer of rows message */
    printf("Enter number of rows: ");
    scanf("%d",&rows);

/* using for loop*/
    for(i=1; i<=rows; ++i)
    {
        for(j=1; j<=i; ++j)
        {
            printf("# ");
        }
        printf("\n");
    }
    return 0;
}


OUTPUT