-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path14.c
42 lines (40 loc) · 783 Bytes
/
14.c
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
38
39
40
41
42
#include <stdio.h>
#include <math.h>
/*
x y
--------------------------
0 0.000000
15 0.258819
30 0.500000
45 0.707107
60 0.866025
75 0.965926
90 1.000000
105 0.965926
120 0.866025
135 0.707107
150 0.500000
165 0.258819
180 0.000000
*/
#define PI 3.14159265
int main()
{
int i;
float j, s;
for (j=1.1; j >= 0; j-=0.1)
{
for (i=0; i<= 180; i+= 15)
{
s = sin(i*PI/180);
if (fabsf(s-j)<=0.1)
{
printf("*");
}
else {
printf(" ");
}
}
printf("\n");
}
}