program to find sine of an angle using c
#include<stdio.h>
#include<math.h>
int main()
{
float s=0,x,i,n,f,p,j,k=2;
printf("Enter the value of n:");
scanf("%f",&n);
printf("\nEnter the value of x:");
scanf("%f",&x);
for(i=1;i<=n;i++)
{
p=pow(x,i);
f=1;
for(j=1;j<=i;j++)
{
f=f*1;
}
s=(p/f)*pow(-1,k++);
}
printf("%f",s);
return(0);
}
#include<stdio.h>
#include<math.h>
int main()
{
float s=0,x,i,n,f,p,j,k=2;
printf("Enter the value of n:");
scanf("%f",&n);
printf("\nEnter the value of x:");
scanf("%f",&x);
for(i=1;i<=n;i++)
{
p=pow(x,i);
f=1;
for(j=1;j<=i;j++)
{
f=f*1;
}
s=(p/f)*pow(-1,k++);
}
printf("%f",s);
return(0);
}
Post a Comment