PROGRAM TO PRINT A DIAMOND OF STARS:
#include<iostream>
using namespace std;
main()
{
int n,j,i,c;
cout<<"ENTER THE NO OF ROWS";
cin>>n;
c=n-1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c--;
for(j=1;j<=2*i-1;j++)
cout<<"*";
cout<<"\n";
}
c=1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c++;
for(j=1;j<=2*(n-i)-1;j++)
cout<<"*";
cout<<"\n";
}
}
#include<iostream>
using namespace std;
main()
{
int n,j,i,c;
cout<<"ENTER THE NO OF ROWS";
cin>>n;
c=n-1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c--;
for(j=1;j<=2*i-1;j++)
cout<<"*";
cout<<"\n";
}
c=1;
for(i=1;i<=n;i++)
{
for(j=1;j<=c;j++)
cout<<" ";
c++;
for(j=1;j<=2*(n-i)-1;j++)
cout<<"*";
cout<<"\n";
}
}