pTutorial

New way to learn C programming

C program to print piramid pattren

This is a user define C program to print piramid pattren with the help of nested for loop and star as shown below.

C piramid pattren program

#include <stdio.h>
#include <conio.h>
void main()
{
   int row, c, n, u;
   printf("Please enter the number of row\n");
   scanf("%d",&n);
   u = n;
   for ( row = 1 ; row <= n ; row++ )
   {
      for ( c = 1 ; c < u ; c++ )
         printf(" ");
         u--;
      for ( c = 1 ; c <= 2*row - 1 ; c++ )
         printf("*");
        printf("\n");
   }
   getch();
}

Download piramid pattren

Output of program

See Also

Print diagonal matrix java   |   Jquery example pdf   |   Php string

QUOTES OF THE DAY

Each day provides its own gifts.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER