DIVISEUR (VC++ V6.0)

cs_dtom Messages postés 30 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 16 novembre 2003 - 15 août 2003 à 13:08
cs_dtom Messages postés 30 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 16 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.

https://codes-sources.commentcamarche.net/source/11260-diviseur-vc-v6-0

cs_dtom Messages postés 30 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 16 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és 30 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 16 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;
}

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;
}
Rejoignez-nous