C Program to Print Heart Star Pattern


Heart pattern in C : The following code display, print heart star shape (💓love) pattern using stars (*) in C language. Also we change the colour of heart and we will use the sleep function to make the heart blink

How to print heart pattern in C ?

1. Start 
2.Accept the height or size of the heart according to which we are going to print or display the heart star pattern.
3.Print two small triangles using for loop for the upper curve of heart, like the two given below.


Two Triangle

4.Below these two triangle print the usual inverted triangle to complete heart star pattern.


The usual inverted triangle

5. The complete generated heart pattern will look something like


Heart star pattern 



C Program to Print Heart Heart Shape(Love Symbol) Pattern



  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<stdlib.h>
  4. #include<dos.h>

  5. int main(){
  6.     system("cls");
  7.     system("color 04");/*There you are also change the colour
  8.  of heart using the colour code*/
  9.     
  10. int i,j,a
  11.     for(a=0;a<=100;a++){
  12.     system("cls");
  13.     sleep(0.1);/*us also change the time of 
  14. blinking heart symbol*/
  15. for(i=0;i<=2;i++) 
  16.   for(j=0;j<=17;j++) 
  17. if((j>=3-i&&j<=6+i)||(j>=12-i&&j<=15+i))
  18. printf("*"); 
  19. }
  20. else {
  21. printf(" "); 
  22. }
  23. printf("\n"); 
  24. for(i=0;i<=9;i++) 
  25. for(j=0;j<=17;j++) 
  26. {
  27. if(j>=i+1&&j<=17-i)
  28. printf("*"); 
  29. }
  30. else {
  31.   printf(" ");
  32.  printf("\n"); 
  33.  sleep(0.1);
  34. }
  35.  return 0;
  36. }