added random stuff
[physik/computational_physics.git] / integral-2_2.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <math.h>
4
5 int main(int argc,char **argv) {
6  double p_N;
7  double p;
8  int steps;
9  int i;
10
11  if(argc!=2) { 
12   printf("usage: %s <steps>\n",argv[0]);
13   return 1;
14  }
15
16  steps=atoi(argv[1]);
17  p_N=M_E-1;
18
19  for(i=0;i<=steps;i++) {
20   printf("p_%d = %f\n",i,p_N);
21   p=M_E-i*p_N;
22   p_N=p;
23  }
24
25   return 1;
26 }