forked from Jayesh0006/hacktoberfest_2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheart_pattern.c
More file actions
37 lines (32 loc) · 720 Bytes
/
heart_pattern.c
File metadata and controls
37 lines (32 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <math.h>
int main()
{
int x,y;
for (x = 0; x < 10; x++)
{
for (y = 0; y <= 4*10; y++)
{
double dist1 = sqrt(pow(x - 10, 2) + pow(y - 10, 2));
double dist2 = sqrt(pow(x - 10, 2) + pow(y - 3*10, 2));
if (dist1 < 10 + 0.5 || dist2 < 10 + 0.5) {
printf("*");
}
else {
printf(" ");
}
}
printf("\n");
}
for ( x = 1; x < 2*10; x++)
{
for ( y = 0; y < x; y++) {
printf(" ");
}
for ( y = 0; y < 4*10 + 1 - 2*x; y++) {
printf("*");
}
printf("\n");
}
return 0;
}