Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------
- -- * idiots.adb
- -- * Role : trouver tous les nombres "idiots" entre 1 et 1000
- -- * Basé sur chiffres.adb
- ----------------------------------------------------------------
- with entrees_sorties; use entrees_sorties;
- procedure idiots is
- nombreCourant : Integer;
- nombreModif : Integer;
- resultat : Integer;
- begin
- nombreCourant := 1;
- while(nombreCourant <= 1000) loop
- nombreModif := nombreCourant;
- resultat := 0;
- while(nombreModif > 0) loop
- resultat := resultat + ((nombreModif) mod 10)**3;
- nombreModif := (nombreModif - (nombreModif mod 10))/10;
- end loop;
- if(nombreCourant = resultat) then
- put(nombreCourant, 0);
- put(" est un nombre idiot.");
- new_line;
- end if;
- nombreCourant := nombreCourant + 1;
- end loop;
- end idiots;
Advertisement
Add Comment
Please, Sign In to add comment