[ create a new paste ] login | about

Link: http://codepad.org/dWQbZ9PV    [ raw code | output | fork | 2 comments ]

C, pasted on Sep 14:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define eps 1e-4 // Sai số
int main()
{
	float S, T, x, LuyThua, GiaiThua;
	int i, Dau = -1;

	printf("\nNhap x(radian): ");
	scanf("%f", &x);

	GiaiThua = 1;
	S = T = LuyThua = x;
	for(i = 3; T > eps; i += 2, Dau = -Dau)
	{
		T = (LuyThua *= x * x) / (GiaiThua *= i * (i - 1));
		S += Dau * T;
	}
	printf("\nCong thuc Taylor: sin (%.2f) = %.4f", x, S);
	printf("\nSin () cua math.h: sin(%.2f) = %.4f", x, sin(x));


	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by test22 on Nov 4

reply
posted by test22 on Nov 4
<h1>Adsad</h1>
reply