In this tutorial we will create a program that print a pyramid pattern by using a symbol. We can use any symbol to make this pyramid pattern. This pyramid pattern like a triangle by a symbol.
In this program we will enter the range(size) of this pyramid and press the enter button then the pyramid will be print on to the screen.
In this output we can see that the range or size of pyramid is 25 and the total lines of symbols in this pyramid is 25.
we will enter the range(size) of this pyramid and press the enter button then the pyramid will be print on to the screen.
In this program we will enter the range(size) of this pyramid and press the enter button then the pyramid will be print on to the screen.
C program code
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,rows,count,temp=1;
printf("\n Enter number of rows:\n ");
scanf("%d",&rows);
printf("\n");
count=rows-1;
for(a=1;a<=rows;a++)
{
for(b=1;b<=count;b++)
{
printf(" ");
}
for(c=1;c<=temp;c++)
{
printf("●");
}
count--;
temp+=2;
printf("\n");
}
getch();
}
OUTPUT:
In this output we can see that the range or size of pyramid is 25 and the total lines of symbols in this pyramid is 25.
we will enter the range(size) of this pyramid and press the enter button then the pyramid will be print on to the screen.
Please share this post and blog link with your friends.For more programs use this blog.
If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com
Created by-- HARSH CHAUHAN
No comments:
Post a Comment