# Newton Raphson's Method C language program - To find Square Root

Posted Date:     Total Responses: 0    Posted By: rajesh kale   Member Level: Silver   Points/Cash: 4

C Language Program - Newton Raphson's Method : To find Square Root

#include
#include
#include
float f(float x,int n)
{
return(x*x-n);
}
float df(float x)
{
return 2*x;
}
void main()
{
float b=5,m,e=0.0001,num;
int i;
clrscr();
printf("\n Newton Raphson's Method : To find Square Root");
printf("\n Enter Number whose Square root to be found :- \n");
scanf("%f",&num);
m=(b)-((f(b,num))/df(b));
i=1;
while(fabs(f(m,num))>e)
{
b=m;
m=(b)-((f(b,num))/df(b));
i=i+1;
printf("\n Square root of %.2f is %.2f",num,m);
getch();
}
}


## Project Feedbacks

Author: Member Level: BronzeRevenue Score:
`#include< stdio.h >#include< conio.h >#include< math.h >float f(float x,int n){ return(x*x-n);}float df(float x){ return 2*x;}void main(){ float b=5,m,e=0.0001,num; int i; clrscr(); printf("\n Newton Raphson's Method : To find Square Root"); printf("\n Enter Number whose Square root to be found :- \n"); scanf("%f",&num); m=(b)-((f(b,num))/df(b)); i=1; while(fabs(f(m,num))>e) { b=m; m=(b)-((f(b,num))/df(b)); i=i+1; printf("\n Square root of %.2f is %.2f",num,m); getch(); }}OUtput Newton Raphson's Method : To find Square Root Enter Number whose Square root to be found :-7 Square root of 7.00 is 2.69 Square root of 7.00 is 2.65 Square root of 7.00 is 2.65`

Post Feedback
Next Project: Newton Raphson method To find Cube Root C Language Program
Previous Project: Implementation of Circular Queue using Array

### Post New Project

Related Projects

Top Contributors
TodayLast 7 Daysmore...