All rights are reserved by Niteesh Kumar.. Theme images by Storman. Powered by Blogger.

Followers

Total Pageviews

Blog Archive

Follow by Email

Translate

Saturday, 3 May 2014

C++ program to print a pyramid of stars


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
intm,n,i,j,k;
cout<<"enter the integer\n";
cin>>n;
for(i=0;i<=n;i++)
{
for(j=0;j<=n-i;j++)
cout<<" ";
for(k=i;k>=0;k--)
cout<<"*";
for(m=1;m<=i;m++)
cout<<"*";
cout<<"\n";
}
getch();
}

OUTPUT
enter the integer
5
          *
        ***
      *****
    *******
  *********
***********

0 on: "C++ program to print a pyramid of stars"