[ create a new paste ] login | about

Link: http://codepad.org/6xXkiBoq    [ raw code | output | fork ]

C, pasted on Jul 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<math.h>
int main(){
	int counter=0.00000001;
	double e=0;
		double x, x0, f, g, err;

	x0=1.0;

		do{
	f=pow(x0,3)-6*pow(x0,2)+7*x0+2;
		g=3*pow(x0,2)-12*x0+7;
		x=x0-(f/g);
		err=fabs(x-x0);
			counter++;
			x0=x;
		}while(err>e);
		printf("反復回数 %d回\n x=%lf\n",counter,x);
return 0;}


Output:
1
2
In function `main':
undefined reference to `pow'


Create a new paste based on this one


Comments: