A program to display the following series:


* * * * * . . . . . . *
* * * * * . . . . . *
* * * * . . . . . *
* * * . . . . . *
* * . . . . . *
* . . . . . *

 

where the number of stars in the first row is entered by the user.

 

#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,n;
cout<<"How many stars do you want in the first line:";
cin>>n;
for(i=n;i>=1;i--)
{
for(j=1;j<=i;j++)
cout<<"*";
cout<<"\n";
}
getch();
}

 

< Back