Home >Backend Development >C#.Net Tutorial >Simple heart code in c language

Simple heart code in c language

angryTom
angryTomOriginal
2020-03-04 18:07:3348245browse

Simple heart code in c language

Simple heart-shaped code in c language

Use c language to create a heart-shaped pattern. For beginners of C language.

Recommended learning: c language video tutorial

The code is as follows:

#include <stdio.h>
int main() {
    for (float y = 1.5f; y > -1.5f; y -= 0.1f) {
        for (float x = -1.5f; x < 1.5f; x += 0.05f) {
            float a = x * x + y * y - 1;
            putchar(a * a * a - x * x * y * y * y <= 0.0f ? &#39;*&#39; : &#39; &#39;);
        }
        putchar(&#39; &#39;);
    }
}

Running effect:

Simple heart code in c language

For more programming-related tutorials, please pay attention to PHP Chinese website!

The above is the detailed content of Simple heart code in c language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn