Hello good morning...I need help on how print the heart beside each other here is the code..

#include <stdio.h>  
#include<stdlib.h>
#include<Windows.h>

int heart()  
{  
    int i, j; 

    for(i=10/2; i<=10; i+=2)  
    {  
        for(j=1; j<10-i; j+=2)  
        {  
            printf(" ");  
        }  

        for(j=1; j<=i; j++)  
        {  
            printf("*");  
        }  

        for(j=1; j<=10-i; j++)  
        {  
            printf(" ");  
        }  

        for(j=1; j<=i; j++)  
        {  
            printf("*");  
        }  

        printf("\n");  
    }  

    for(i=10; i>=1; i--)  
    {  
        for(j=i; j<10; j++)  
        {  
            printf(" ");  
        }  

        for(j=1; j<=(i*2)-1; j++)  
        {  
            printf("*");  
        }  

       printf("\n");
    }  

    return 0;  
}  



void main(){
    int i;
heart();  


}

Recommended Answers

All 2 Replies

What is the output supposed to look like?

the two hearts should be beside each other

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.