Program to print asterisk(*) pattern in C++ #1

 

Program to print an asterisk(*) pattern

*            *

**         **

***      ***

****   ****

**********

*/

 

#include<iostream.h>

#include<conio.h>

void main()

{

    clrscr();

    int i,j,k,l,m;

    for(i=1;i<=5;i++)

  {

  cout<<"\n";

for(m=1;m<=i;m++)

    {

                cout<<"*";

    }

           for(j=5;j>i;j—)

            {

                     cout<<" ";

            }

         for(l=5;l>i;l—)

          {

                   cout<<" ";

           }

       for(k=1;k<=i;k++)

    

         {

                  cout<<"*";

          }

   }

getch();

}

Comments