![]() |
A-Pyramid |
Hello programmer print the A-Pyramid easily with me.Copy the given source code and try it on turbo c++ or gcc enjoy your program and try to modify it.
Note:- This program is created on the turbo c++
All The Best!!!!!!!!!!!!!!!!!!!!!!!!!!
Coding:-
/*A-Pyramid*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,m,y;
int n,r;
clrscr();
printf("Enter the number of rows.");
scanf("%d",&n);
r=n;
for(i=0;i<=n;i++)
{
for(j=0;j<=r;j++)/*Starting spaces*/
printf(" ");
r--;
for(k=0;k<=0;k++)/*number of stars*/
printf("*");
for(l=0;l<=i;l++)/*for the middle line and spaces*/
{
if(i==n/2+1)
{
for(y=0;y<=0;y++)/*stars of center line*/
printf("*");
}
else
printf(" ");
}
for(m=0;m<=0;m++)/*stars after the final spaces*/
printf("*");
printf("\n");
}
getch();
}
No comments:
Post a Comment