The code given bellow will make a shape of heart. Hope u will like it.
#include<stdio.h>
#include<conio.h>
int main(void)
{
clrscr();
int i,j,k;
textbackground(WHITE);
for(i=0,k=11;i<=90;i+=10,k+=10)
{
printf("\r\t\t\t");
for(j=i;j<k;j++)
if((j==13||j==17)||(j>=22&&j<=24)||(j>=26&&j<=28)||(j>=31 && j<=39)||(j>=41&&j<=49)||(j>=52&&j<=58)||(j>=63&&j<=67)||(j>=74&&j<=76)||(j==85))
{
textcolor(RED);
cprintf("*");
}
else
{
textcolor(GREEN);
cprintf(".");
}
cprintf("\n");
}
printf("\r\t\t ");
cprintf("Happy valentine day\n");
getch();
}
#include<stdio.h>
#include<conio.h>
int main(void)
{
clrscr();
int i,j,k;
textbackground(WHITE);
for(i=0,k=11;i<=90;i+=10,k+=10)
{
printf("\r\t\t\t");
for(j=i;j<k;j++)
if((j==13||j==17)||(j>=22&&j<=24)||(j>=26&&j<=28)||(j>=31 && j<=39)||(j>=41&&j<=49)||(j>=52&&j<=58)||(j>=63&&j<=67)||(j>=74&&j<=76)||(j==85))
{
textcolor(RED);
cprintf("*");
}
else
{
textcolor(GREEN);
cprintf(".");
}
cprintf("\n");
}
printf("\r\t\t ");
cprintf("Happy valentine day\n");
getch();
}
Screenshot of the output ! |
Add caption |