Printing_love_patterns💝
💝1.First pattern💝
Output:Heart symbol..
#include<iostream.h>
#include<conio.h>
int main()
{
int i,j,a,b;
clrscr();
for(j=1;j<=3;j++)
{
for(i=1;i<=20;i++)
{
if(i>=4-j&&i<=6+j||i>=15-j&&i<=17+j)
{cout<<"$";}
else
cout<<" ";
}
cout<<endl;
}
for(a=1;a<=11;a++)
{
for(b=1;b<=20;b++)
{
if(b>=a-1&&b<=21-a)
{
cout<<"$";
}
else
cout<<" ";
}
cout<<endl;
}
getch();
}
#include<iostream.h>
#include<conio.h>
int main()
{
int i,j,a,b;
clrscr();
for(j=1;j<=3;j++)
{
for(i=1;i<=20;i++)
{
if(i>=4-j&&i<=6+j||i>=15-j&&i<=17+j)
{cout<<"$";}
else
cout<<" ";
}
cout<<endl;
}
for(a=1;a<=11;a++)
{
for(b=1;b<=20;b++)
{
if(b>=a-1&&b<=21-a)
{
cout<<"$";
}
else
cout<<" ";
}
cout<<endl;
}
getch();
}
💥💥2.Printing 💝hearts in 💟heart shape💥💥
2nd output:Printing 💝in heart shape
#include<iostream.h>
#include<conio.h>
int main()
{
int i,j,a,b;
clrscr();
for(j=1;j<=3;j++)
{
for(i=1;i<=20;i++)
{
if(i>=4-j&&i<=6+j||i>=15-j&&i<=17+j)
{cout<<"💝";}
else
cout<<" ";
}
cout<<endl;
}
for(a=1;a<=11;a++)
{
for(b=1;b<=20;b++)
{
if(b>=a-1&&b<=21-a)
{
cout<<"💝";
}
else
cout<<" ";
}
cout<<endl;
}
getch();
}
3. Printing names{Nani💝sri} in heart shape..
Out put:Nani💝sri in heart
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
int main()
{
int i,j,a,b;
clrscr();
for(j=1;j<=3;j++)
{
for(i=1;i<=20;i++)
{
if(i>=4-j&&i<=6+j||i>=15-j&&i<=17+j)
{cout<<"💝";}
else
cout<<" ";
}
cout<<endl;
}
cout<<" \t Nani💝Sri \n";
for(a=1;a<=11;a++)
{
for(b=1;b<=20;b++)
{
if(b>=a-1&&b<=21-a)
{
cout<<"💝";
}
else
cout<<" ";
}
cout<<endl;
}
getch();
}
Comments