Creating a heart

 #include<iostream>

using namespace std;

int main ()

{ int i,j,k,l,m,n,o;

for(i=1;i<=3;i++)

{cout<<endl;

  for(k=8;k>=2*i +2;k--)

  {

    cout<<" ";

  }

   for(j=1;j<=2*i+2;j++)

   {

       cout<<"* ";

   }

   for(l=8;l>=2*i+2;l--)

   {

       cout<<"  ";

   }

   for(j=1;j<=2*i+2;j++)

   {

       cout<<"* ";

   }


}

for (i=1;i<=9;i++)

{cout<<endl;

for(k=1;k<=2*i-1;k++)

{

    cout<<" ";

}

    for(j=18;j>2*i-1;j--)

    {

        cout<<"* ";

    }

}


return 0;

}



Comments

Popular posts from this blog

Write a program to store the roll no. (starting from 1), name and age of 5 students and then print the details of the student with roll no. 2.