fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. double fact(int N)
  5. {
  6. if(N < 0)
  7. return 0;
  8. if (N == 0)
  9. return 1;
  10. else
  11. return N * fact(N - 1);
  12. }
  13. int main() {
  14. double x=1, y, p, pogr;
  15. double count=1, befy=0, n=0;
  16. int a=10;
  17. while (a>=0) {
  18. p=pow(-1,n)*pow(x,n)/fact(n);
  19. n++;
  20. cout <<"\t" <<p;
  21. a--;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
	1	-1	0.5	-0.166667	0.0416667	-0.00833333	0.00138889	-0.000198413	2.48016e-05	-2.75573e-06	2.75573e-07