Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

All Asterisk Patterns

Below is a complete list of all the Asterisk patterns. All these codes have been complied in Turbo C++ Compiler. Outputs of all the codes have been put below the respective codes.

 
                                   


*
**
***
****
*****
 Code: 
#include<iostream.h>
#include<conio.h>
 
void main()
{int row,i,j;
 clrscr();
 cout<<"Enter the number of rows you want: \n";
 cout<<row;
 for(i=1;i<=row;i++)
 {
  for(j=1;j<=i;j++)
  {
   cout<<"* ";
  }
  cout<<"\n";
 }
 getch();
} 



    *
   **
  ***
 ****
*****
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int i, j, k, row;
 clrscr();
 cout<<"Enter the number of rows you want:\n";
 cin>>row;
 for(i=row;i>=1;i--)
 {
  for(j=1;j<i;j++)
  {
   cout<<" ";
  }
  for(k=row;k>=i;k--)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
 getch();
}
 
 
*****
****
***
**
* 
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int i, j, k, row;
 clrscr();
 cout<<"Enter the number of rows you want:\n";
 cin>>row;
 for(i=row;i>=1;i--)
 {
  for(j=row;j>i;j--)
  {
   cout<<" ";
  }
  for(k=1;k<=i;k++)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
 getch();
} 
 
 
    *
   *** 
  *****
 *******
********* 
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k,row;
 clrscr();
 cout<<"Enter the number of rows you want:\n";
 cin>>row;
 for(i=1;i<=row;i++)
 {
  for(j=i;j<row;j++)
  {
   cout<<" ";
  }
  for(k=1;k<(i*2);k++)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
 getch();
} 
 
 
*********
 *******
  ***** 
   ***   
    *
 Code:              
#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k,row;
 clrscr();
 cout<<"Enter the number of rows you want:\n";
 cin>>row;
 for(i=row;i>=1;i--)
 {
  for(j=row;j>i;j--)
  {
   cout<<" ";
  }
  for(k=1;k<(i*2);k++)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
 getch();
} 
 
 
**********
****  **** 
***    ***
**      **
*        *
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int row,i,j;
 clrscr();
 cout<<"Enter the number of rows you want: \n";
 cin>>row;
 for(i=row;i>=1;i--)
 {
  for(j=1;j<=i;j++)
  {
   cout<<"*";
  }
 for(j=row;j>=1;j--)
    {
      if(j<=i)
      {
    cout<<"*";
      }
      else
      {
    cout<<"  ";
      }
    } 
  cout<<"\n";
 }
 getch();
} 
 
 
*        *
**      **
***    ***
****  ****
**********
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
  int i,j,k,row;
  clrscr();
  cout<<"Enter the number of rows you want:\n";
  cin>>row;
  cout<<"\n";
  for(i=1;i<=row;i++)
  {
    for(j=1;j<=row;j++)
    {
      if(j<=i)
   {
       cout<<"*";
      }
      else
   {
       cout<<" ";
      } 
    }
    for(j=row;j>=1;j--)
    {
      if(j<=i)
   {
       cout<<"*";
      }
      else
   {
       cout<<" ";
      }
    }
    cout<<"\n";
  }
  getch();
}
 
 
    *
   *** 
  *****
 *******
*********
 *******
  *****
   ***   
    *  
 
Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k;
 clrscr();
 for(i=1;i<=5;i++)
 {
  for(j=i;j<5;j++)
  {
   cout<<" ";
  }
  for(k=1;k<(i*2);k++)
  {
   cout<<"*";
  }
   cout<<"\n";
 }
 for(i=4;i>=1;i--)
 {
  for(j=5;j>i;j--)
  {
   cout<<" ";
  }
  for(k=1;k<(i*2);k++)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
 getch();
} 
 
 
 
**********
****  ****
***    ***
**      **
*        *
**      **
***    ***
****  ****
**********
 Code:          
#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k;
 clrscr();
 for(i=1;i<=5;i++)
 {
  for(j=1;j<=6-i;j++)
  {
   cout<<"*";
  }
  for(k=1;k<i;k++)
  {
   cout<<"  ";
  }
  for(j=1;j<=6-i;j++)
  {
   cout<<"*";
  }
  cout<<"\n";
 }
  for(i=2;i<=5;i++)
 {
  for(j=1;j<=i;j++)
     cout<<"*";
  for(k=1;k<=5-i;k++)
  {
   cout<<"  ";
  }
  for(j=1;j<=i;j++)
  {
  cout<<"*";
  }
  cout<<"\n";
 }
 getch();
}
 

4 comments:

  1. Awesome sir! This was super helpful, thank you so much!

    ReplyDelete
  2. It was super and very helpful for me, thank you so much for having such a good support GOOGLE!

    ReplyDelete
  3. *****
    ****
    ***
    **
    *
    **
    ***
    ****
    *****

    Tell me thus code Immediately plz

    ReplyDelete
  4. **********
    **** ****
    *** ***
    ** **
    * *
    ** **
    *** ***
    **** ****
    **********


    Using javascript

    ReplyDelete

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)