forked from sanchitahuja/CP-4th-Sem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.cpp
More file actions
36 lines (30 loc) · 611 Bytes
/
Copy path10.cpp
File metadata and controls
36 lines (30 loc) · 611 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
#include<stdio.h>
#include<math.h>
unsigned long long int fact(int y)
{
if(y<=1)
return 1;
return y*fact(y-1);
}
int main()
{
int j;
float angl,x,xpow,sum=0;
printf("\nEnter the value of x in Degrees");
scanf("%f",&angl);
x=(3.14159265*angl)/180;
for(int i=0;i<10;i++)
{
j=2*i+1;
printf("\n%d",j);
xpow=pow(x,j);
printf("--- %lu",fact(j));
if(i%2==0)
sum+=(xpow/fact(j));
else
sum-=(xpow/fact(j));
printf("--- %f",sum);
}
printf("\nSin(%f) = %f",angl,sum);
return 1;
}