Program to print pattern - Diamond

#include<iostream>
using namespace std;
int main()
{
for(int i=1;i<=4;i++)
{
cout<<endl;
for(int s=1;s<=4-i;s++)
cout<<" ";
for(int j=1;j<=2*i-1;j++)
cout<<"*";
}
cout<<endl;A
for(int i=4;i>=1;i--)
{
for(int s=1;s<=4-i;s++)
cout<<" ";
for(int j=1;j<=2*i-1;j++)
cout<<"*";
cout<<endl;
}
return 0;
}


By Ayush Gupta, Student

Comments