C++ program for Printing Heart Shape

Program Code:

#include<iostream>
using namespace std;
int main()
{
cout<<"\n\n\n\n\n";
for(int i=0;i<15;i++)
cout<<" ";
cout<<"*         *";
cout<<endl;
for(int j=0;j<13;j++)
cout<<" ";
cout<<"*   *     *   *";
cout<<endl;

for(int k=0;k<11;k++)
cout<<" ";
cout<<"*      *   *      *";
cout<<endl;

for(int l=0;l<11;l++)
cout<<" ";
cout<<"*       * *       *";
cout<<endl;
for(int m=0;m<11;m++)
cout<<" ";
cout<<"*        *        *";
cout<<endl;
for(int n=0;n<11;n++)
cout<<" ";
cout<<"*                 *";
cout<<endl;
for(int o=0;o<12;o++)
cout<<" ";
cout<<"*               *";
cout<<endl;

for(int p=0;p<13;p++)
cout<<" ";
cout<<"*             *";
cout<<endl;
for(int q=0;q<14;q++)
cout<<" ";
cout<<"*           *";
cout<<endl;
for(int r=0;r<15;r++)
cout<<" ";
cout<<"*         *";
cout<<endl;
for(int s=0;s<17;s++)
cout<<" ";
cout<<"*     *";
cout<<endl;
for(int t=0;t<20;t++)
cout<<" ";
cout<<"**";
cout<<endl;
return 0;
}

Output:

.exe file

1 comment:

  1. Anonymous6:35 am

    not bad really nice code tried it works great.

    ReplyDelete

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.