Square Root of a number by using simple calculations

#include
#include
main()
{
float a,b,e=0.00001,p,k;
clrscr();
textcolor(GREEN);
do {
printf("*******************************************************");
printf(" PROGRAM TO FIND SQUARE ROOT OF A NUMBERxDB
");
printf("*********************************************************");
cprintf("ENTER A NUMBER(-1 to Quit) :");
scanf("%f",&k);

a=k;p=a*a;
while(p-k>=e)
{
b=(a+(k/a))/2;
a=b;
p=a*a;
}
printf("SQUARE ROOT IS = %f",a);
getch();
clrscr();
}
while(k!=-1);
getch();
}

2 comments:

  1. how we can depend this codes of this program?
    in what way?

    please explain how the use of the codes and strings.
    thank you
    asap

    ReplyDelete
  2. hi..you can use simple C Compilers to compile this programs & you will get output...simple..have a good day...

    ReplyDelete