Thursday 25 October 2018

Star Pattern in c/c++ programming

Normal And Reverse Star Pattern in C++
*            *
**        **
***    ***
********
source code:




#include<iostream.h>
#include<conio.h>

       void main()
       {
int i,j,n;
clrscr();
cout<<"Enter number of lines=";    //taking values for n
cin>>n;
      for(i=0;i<=n;i++)               //main loop
{ for(j=0;j<=i;j++)             //normal * pattern
{  cout<<"*"; }
  for(j=0;j<n-i;j++)           //for printing spaces
{ cout<<"  "; }
  for(j=0;j<=i;j++)            //reverse * pattern
{ cout<<"*";  }
cout<<"\n";
}
getch();                       //for holding output screen
       }


1 comment:

  1. Slots & Games 2021 | Casino Site - Lucky Club
    Experience the excitement of classic casino games with over 200 free spins for you to play. Check luckyclub.live out the slots, roulette, video poker,

    ReplyDelete