- /**************************************\
- * Root Calculator *
- * Version 1.00 *
- * Started The 11th March 2002 *
- * By Nicolas BENOIT, ndj55@free.fr *
- * http://www.ndj55.fr.fm *
- \**************************************/
-
- /*
- Ce programme est basé sur le programme 'Racine' créé par obasileus.
- */
-
- //--------------------------------------------------------------------------------
- //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- //--------------------------------------------------------------------------------
-
-
- #include <stdio.h>
-
- //--------------------------------------------------------------------------------
- //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- //--------------------------------------------------------------------------------
-
- int main(void)
- {
- unsigned long int nombre = 0;
- unsigned long int iteration = 0;
- unsigned long int diviseur = 2;
-
- double temp;
- double root;
-
- printf("Carre de la racine recherchee : ");
- scanf("%i",&nombre);
- printf("Precision : ");
- scanf("%i",&iteration);
-
- temp = nombre / 2.0;
- root = temp;
-
- while (iteration != 0)
- {
- if (((root * root) > nombre) && (root > 0))
- {
- root -= (temp / diviseur);
- }
- else
- {
- root += (temp / diviseur);
- }
-
- if ((root * root) == nombre)
- {
- break;
- }
-
- diviseur += 2;
- --iteration;
- }
-
- printf("\a\n\nRacine Approximative =\t%.10f\nCarre Approximatif =\t%f\n",root,root*root);
-
- getchar();
-
- while (getchar() == 0)
- {
- getchar();
- }
-
- return 0;
- }
-
- //--------------------------------------------------------------------------------
- //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- //--------------------------------------------------------------------------------
/**************************************\
* Root Calculator *
* Version 1.00 *
* Started The 11th March 2002 *
* By Nicolas BENOIT, ndj55@free.fr *
* http://www.ndj55.fr.fm *
\**************************************/
/*
Ce programme est basé sur le programme 'Racine' créé par obasileus.
*/
//--------------------------------------------------------------------------------
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//--------------------------------------------------------------------------------
#include <stdio.h>
//--------------------------------------------------------------------------------
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//--------------------------------------------------------------------------------
int main(void)
{
unsigned long int nombre = 0;
unsigned long int iteration = 0;
unsigned long int diviseur = 2;
double temp;
double root;
printf("Carre de la racine recherchee : ");
scanf("%i",&nombre);
printf("Precision : ");
scanf("%i",&iteration);
temp = nombre / 2.0;
root = temp;
while (iteration != 0)
{
if (((root * root) > nombre) && (root > 0))
{
root -= (temp / diviseur);
}
else
{
root += (temp / diviseur);
}
if ((root * root) == nombre)
{
break;
}
diviseur += 2;
--iteration;
}
printf("\a\n\nRacine Approximative =\t%.10f\nCarre Approximatif =\t%f\n",root,root*root);
getchar();
while (getchar() == 0)
{
getchar();
}
return 0;
}
//--------------------------------------------------------------------------------
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//--------------------------------------------------------------------------------