kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Sunday, December 28, 2014


//viết hàm tính sin(x)
#include<stdio.h>
#include<conio.h>
#include<math.h>
double sin(double x)
{
double ps = x, i = 1, tong = x,dau=-1;
while (fabs(ps) > 0.00001)
{
ps = ps*x*x / ((i + 1)*(i + 2));
tong += dau*ps;
dau = -dau;
}
return tong;
}
void main()
{
double x;
printf("x="); scanf_s("%lf", &x);
printf("%lf\n", sin(x));
}

0 comments:

Post a Comment

domain, domain name, premium domain name for sales

Popular Posts