ΠΡΟΓΡΑΜΜΑ αναζήτηση_τέλειων_αριθμών ΜΕΤΑΒΛΗΤΕΣ ΑΚΕΡΑΙΕΣ: arith,ι,athr,metr2,metr,apotel,mo, range ΑΡΧΗ metr <-- 1 arith <-- 1 metr2 <-- 1 apotel <-- 0 mo <-- 0 ΓΡΑΨΕ 'ΔΩΣΤΕ ΜΟΥ ΤΟ ΕΥΡΟΣ ΑΝΑΖΗΤΗΣΗΣ ΤΕΛΕΙΩΝ ΑΡΙΘΜΩΝ' ΔΙΑΒΑΣΕ range ΟΣΟ range > 1000 ΕΠΑΝΑΛΑΒΕ ΓΡΑΨΕ 'ΠΑΡΑΚΑΛΩ ΔΩΣΤΕ ΜΟΥ ΕΝΑΝ ΑΡΙΘΜΟ ΑΠΟ ΤΟ 1 ΕΩΣ ΤΟ 1000' ΔΙΑΒΑΣΕ range ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ ΟΣΟ metr <= range ΕΠΑΝΑΛΑΒΕ athr <-- 0 ΓΙΑ ι ΑΠΟ 1 ΜΕΧΡΙ arith div 2 ΑΝ arith MOD ι = 0 ΤΟΤΕ athr <-- athr + ι ΑΝ athr = arith ΚΑΙ ι=arith div 2 ΤΟΤΕ ΓΡΑΨΕ 'Ο ΑΡΙΘΜΟΣ', arith, 'ΕΙΝΑΙ ΤΕΛΕΙΩΣ' apotel <-- apotel + arith mo <-- apotel div metr2 metr2 <-- metr2 + 1 ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ arith <-- arith + 1 metr <-- metr + 1 ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ ΑΝ mo > 0 ΤΟΤΕ ΓΡΑΨΕ ' Ο ΜΕΣΟΣ ΟΡΟΣ ΕΙΝΑΙ', mo ΑΛΛΙΩΣ ΓΡΑΨΕ 'ΔΕΝ ΕΙΠΑΡΧΕΙ ΤΕΛΕΙΩΣ ΑΡΙΘΜΟΣ' ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΠΡΟΓΡΑΜΜΑΤΟΣ