cs_dtom
Messages postés30Date d'inscriptionmercredi 22 janvier 2003StatutMembreDernière intervention16 novembre 2003
-
15 août 2003 à 13:08
cs_dtom
Messages postés30Date d'inscriptionmercredi 22 janvier 2003StatutMembreDernière intervention16 novembre 2003
-
15 août 2003 à 13:32
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
cs_dtom
Messages postés30Date d'inscriptionmercredi 22 janvier 2003StatutMembreDernière intervention16 novembre 2003 15 août 2003 à 13:32
J'oubliais : si vous vouler vraiment un algorithme mathématique utille et fonctionnel aller voir :
http://www.cppfrance.com/article.aspx?Val=2301 ET SURTOUT REGARDER LA CAPTURE D'ECRAN !
cs_dtom
Messages postés30Date d'inscriptionmercredi 22 janvier 2003StatutMembreDernière intervention16 novembre 2003 15 août 2003 à 13:08
dans main()
int toto=5772;
int tmp;
while(toto>1)
{
printf("%d",tmp=mydiv(toto));
toto/=tmp;
}
15 août 2003 à 13:32
http://www.cppfrance.com/article.aspx?Val=2301
ET SURTOUT REGARDER LA CAPTURE D'ECRAN !
15 août 2003 à 13:08
int toto=5772;
int tmp;
while(toto>1)
{
printf("%d",tmp=mydiv(toto));
toto/=tmp;
}
int mydiv(int nb)
{
if(nb<=2)
{
if(nb<0){return -1;}
else if(nb==0)return 0;
else if(nb==1)return 1;
else return 2;
}
for(int i=3;i*i<=nb;i+=2)if(nb%i==0)return i;
return nb;
}