Professional Documents
Culture Documents
ΑΛΓΟΡΙΘΜΟΙ ΚΑΙ ΠΡΟΓΡΑΜΜΑΤΑ
ΑΛΓΟΡΙΘΜΟΙ ΚΑΙ ΠΡΟΓΡΑΜΜΑΤΑ
; 3
. 3
. 4
. 6
; 6
; 6
( )
LOGO. 8
LOGO(
). 9
()
. 10
. 13
Page2
;
:
()
.
.
,
.
:
1.
.(
)
2.
.
3.
.
4.
.
:
1.
2.
3.
.
() :
1.
2.
3.
4.
.
Page3
.
()
.
:
,
(.. )
(.. > )
Page4
:
(a, b).
a, b
gin
a * b
gin
Page5
.
.
...
( ) /.
;
,
( -).
,
(, )
.
, (
) .
LOGO.
;
2 .
.
Page6
/. ()
.
()
/.
, ' .
. ..
: : .
.
.
. . = 3,14.
(); LOGO
make . ( 1 make )
;
()
. H 2 , .
2
.
. ..
( ), ,
.
. ..
1.
0 ( 0)
2. ( 5, 5
)
3.
+ 2 ( 5,
5+2 7 7
)
( 1,2,3 make )
Page7
( )
LOGO.
make LOGO:
1.
.
.. make " 0 (
0)
-
2.
.
.. make sum 2 + 2 (
2+2 (4)
sum).
3.
()
.
.. make sum :a + 2 ( :a 5
5+2
(7) sum).
4.
.
.. : make number readword.
( 5) number.
.. : make word readlist.
( )
word.
Page8
print(pr) LOGO.
print LOGO
.
pr:
1.
pr goodmorning ( : goodmorning).
2.
pr :x ( x 7,
, : 7)
3.
pr [very good day] (
: [ ])
4.
LOGO( ).
LOGO ,
.
.
:
1.
( ).
2.
(
).
3.
( / ).
( )
/.
(
LOGO
) end.
Page9
LOGO
1:
to ginomeno
make a readword
make b readword
(
a, b.
make gin :a * :b
.
gin )
()
pr :gin
end
()
()
.
:
1. ( )
2.
a. (
)
b. (
) (
)
c.
().
3. ().
4. ( )
(LOGO).
5. / .
,
.
Page10
:
1.
:
. .
2.
.
a. :
()
()
,
.
b.
:
: a, b, c (
)
: sum ( )
c.
:
a, b, c
sum.
3.
Page11
4.
( )
(LOGO).
5. / .
A :
5, 10, 15 a, b, c,
make sum :a + :b + :c sum
30. pr :sum,
/ sum ( 30).
.
,
( ):
1.
2.
3.
.
Page12
1.
. .
..
Page13
2.
( ).
,
() ()1 ()
()2
LOGO :
ifelse [ ()1] [()2]
( )
()1 .
( )
()2 .
:
.
Page14
a.
make at -1 * :a( [-1] * ,
+ ,
),
make at :a.
at.
,
() ()1, ()1
.
()1
LOGO :
if [ ()1]
( )
()1 .
( )
()1 .
Page15
: 2 .
max_ab, 8 a 6
b.
max b,
6.
if
a b. 8
6 ,
max a ( 8).
max(
8) print.
Page16
3. .
. ( )
.
2 . REPEAT-UNTIL
WHILE-DO.
2 ,
.
. i j k.
.
(REPEAT-UNTIL)
.
i
0
.
i +1
()
i = 3
9
.
H/O () () i = 3
(). () (
).
/ ()
.
Page17
i = 3;
.
i.
:
1)
. ( 0).
.
i
0
2)
(
7) 2
(i).
i
i +1
i 1
i. i
0,
i
i + 1
0 1.
i 1.
3)
i = 3. 3
. ;
,
i 1.
i = 3;
i 1.
9 ,
.
i
i + 1 .
i 2 ( 1
+ 1 2).
i = 3;
i 2.
. i 3.
i = 3;
3.
. ,
9 .
Page18
:
- ;
- 3 .
- ;
- i .
- ;
-
i = 3
LOGO REPEAT-UNTIL :
make i 0
( )
do.until [ make i :i + 1 ()] [:i = n] ( n
).
LOGO REPEAT-UNTIL
9, :
10
/ () 9,
print :i.
:
11
Page19
.
.
,
.
:
.
.
50. 3 .
: )
) .
.
1.
( )
.
. 50.
3 .
: )
) .
2.
) (
)
) (
) (
)
- : poso_math_tra (
a), poso_math_trb ( b),
poso_math_trc ( c).
- : syn_poso_math_et (
), syn_poso_tam_et (
)
Page20
)
().
.
50 .
.
: trexon_math.
make trexon_math 0.
REPEAT-UNTIL
.
. .
: trexon_math = 50; ( 50 )
.
. 2 .
.
syn_poso_math_et.
syn_poso_tam_et. (
).
, ,
. syn_poso_math_et
(
)
.
Page21
3.
syn_poso_tam_et
trexon_math
trexon_math
trexon_math + 1
syn_poso_math_et
poso_math_tra
syn_poso_math_et
Syn_poso_math_et + poso_math_tra
,
( ),
poso_math_trb
syn_poso_math_et
syn_poso_math_et + poso_math_trb
poso_math_trc
syn_poso_math_et
syn_poso_math_et + poso_math_trc
syn_poso_math_et
syn_poso_tam_et
OXI
syn_poso_tam_et + syn_poso_math_et
trexon_math = 50
NAI
syn_poso_tam_et
.
.
,
!
12
Page22
( )
(LOGO).
13
To 5 50.
.
5
/ .
14
Page23
(WHILE-DO).
. (REPEATUNTIL)
(()), () (
15 i < 3;).
(), /
()
i < 3
i +1
()
15
LOGO WHILE-DO :
make i 0
( )
while [:i < n] [make "i :i + 1 ()] ( n
).
LOGO WHILE-DO
15, :
16
/ () 15,
print :i.
Page24
17
Page25