You are on page 1of 1

1: /* Problem Number - 14 Page No.

:
2: Program: Solution of trancedental equation by newton raphson method
3: (Multiple root)
4: Roll NO.: 203544-21-0067
5: Registration No.: 544-1111-0487-20 */
6: #include<stdio.h>
7: #include<math.h>
8: #define m 2
9: float f(float x);
10: float f1(float x);
11: int main()
12: {
13: float x,h,error=1e-7;
14: printf("Enter the initial value\n");
15: scanf("%f",&x);
16: h=-m*f(x)/f1(x);
17: while(fabs(h)>error)
18: {
19: x=x+h;
20: h=-m*f(x)/f1(x);
21: }
22: printf("Root=%7.5f(correct upto five decimal places)",x);
23: }
24: float f(float x)
25: {
26: float y;
27: y=pow(x,3)-5*pow(x,2)+8*x-4;
28: return(y);
29: }
30: float f1(float x)
31: {
32: float y;
33: y=3*pow(x,2)-10*x+8;
34: return(y);
35: }

You might also like