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
}
* *
** **
*** ***
********
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
}
Slots & Games 2021 | Casino Site - Lucky Club
ReplyDeleteExperience the excitement of classic casino games with over 200 free spins for you to play. Check luckyclub.live out the slots, roulette, video poker,