Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Asd
Language: C/C++
Code:
#include<stdio.h>
#include<math.h>
int main()
{
float ps=1.0,pd=4.0,mij=2.0,nr;

printf("Numar (Nr reale din intervalul 1-10) = ");
scanf("%f",&nr);
while((-1e-6>nr-mij*mij)||(nr-mij*mij>1e-6))
    {
    if(mij*mij>nr)
            pd=mij;
        else
            ps=mij;
    mij=(ps+pd)/2.0;
    }

printf("Radicalul numarului este %f",mij);
return 0;
}

          
Comments: