SlideShare a Scribd company logo
1 of 9
(2201-2410)
1.
1.

if...then
if
ตั ย่ง 1
วอ า ที่
P
rogramex_if1;
U CT
ses R ;
V i : integer;
ar
B
egin
Clrs
cr;
W ('Ple s ine i = ;re d (i );
rite ae s rt ') a ln
if i>0th nW ('i mreth n1 ');
1 e rite o a 0
re d ;
a ln
E
nd.

then
ผ ลั ธ์ ไ
ล พ ทีด้
่

if...thensert i =
Ple s in
ae
_

พิ พ์ วเล น้อ ก 1 ห พิ พ์ ข1
ม ตั ข ย ว่า 0 รือ ม เล 0
ค สังที่ ยู่ ลั thenจ ทงา
า ่ อห ง
ะไม่ า น
ถ้ ใส่ตั ข า ก 10โป ก จ
า วเล ม ก ว่า
รแ รม ะ
ทงา งนี้
า นดั
im than 10
ore

2201-2410)
if...then Else
if

Else

then
Else

ตั ย่ง 1
วอ า ที่
ผ ลั ธ์ ไ
ล พ ทีด้
่
P
rogramex_else1;
U CT
ses R ;
Ple s ine i =
ae s rt _
V i : integer;
ar
พิ พ์ วเล ม ก 1 โป ก จ า
ม ตั ข าก ว่า 0 รแ รม ะทงาน
i m than 10_
ore
B
egin
Clrs
cr;
W ('Ple s ine i = ;re d (i ); หาก วเล น้อ ก 1 จ ราก อ วาม
rite ae s rt ') a ln
ใส่ตั ข ย ว่า 0 ะป ฎข้ ค
i lessthanor equal10
if i>0th n
1 e
W ('i mreth n1 ')
rite o a 0
Els
e
W ('i lesth no e u l 1 ');
rite s a r q a 0
re d ;
a ln
E
nd.

if...then..Else

2201-2410)
Case...of
Case
If
of

Case

Else

n:

End;
2201-2410)
if

Case...of

ตั ย่ง 1
วอ า ที่
P
rogramex_if;
U CT
ses R ;
V Score : integer;
ar
B
egin
Clrs
cr;
W (' ine Yo rSco = ;re d (Sco );
rite s rt u re ') a ln re
if (Sco > 8 )a d (Sco < 1 0 th n
re =0 n
re = 0 ) e
W ('Yo rGra eisA');
rite u d
if (Sco > 7 )a d (Sco <0 th n
re =0 n
re 8 ) e
W ('Yo rGra eisB');
rite u d
if (Sco > 6 )a d (Sco <0 th n
re =0 n
re 7 ) e
W ('Yo rGra eisC');
rite u d
if (Sco > 5 )a d (Sco <0 th n
re =0 n
re 6 ) e
W ('Yo rGra eisD ;
rite u d ')
if (Sco > 0)a d (Sco <0 th n
re = n
re 5 ) e
W ('Yo rGra eisF');
rite u d
if (Sco > 0)a d (Sco >0 ) th n
re = n
re 1 0 e
W ('Yo rs reisin rre ;
rite u co co ct')
re d ;
a ln
E
nd.

A , B , C, D

ผ ลั ธ์ ไ
ล พ ทีด้
่

F

ine Yo rSco =
s rt u re _
ค นนม ก
ะแ าก ว่าหรือ ากั 80แ ไม่ น100
เท่ บ ต่ เกิ
ได้ รดA
เก
ค นนม ก
ะแ าก ว่าหรือ ากั 70แ น้อ ก 80
เท่ บ ต่ ย ว่า
ได้ รดB
เก
ค นนม ก
ะแ าก ว่าหรือ ากั 60แ น้อ ก 70
เท่ บ ต่ ย ว่า
ได้ รดC
เก
ค นนม ก
ะแ าก ว่าหรือ ากั 50แ น้อ ก 60
เท่ บ ต่ ย ว่า
ได้ รดD
เก
ค นนม ก
ะแ าก ว่าหรือ ากั 0แ น้อ ก 50
เท่ บ ต่ ย ว่า
ได้ รดF
เก

2201-2410)
Repeat Until
Loop
Loop Repeat Until
Repeat
Until

Until
2201-2410)
Repeat Until
ตั ย่ง1
วอ า
P
rogramexloop1;
U CT
ses R ;
V k: B
ar yte
B
egin
Clrs
cr;
k:= ;
0
re e t
pa
k:= 1
k+;
W ('T isloop', k);
rite his
until k=5;
readln;
E
nd.

ผ ลั ธ์ ไ
ล พ ทีด้
่

T isislo p
h o1
T isislo p
h o2
T isloop3
his
T isloop4
his
T isloop5
his

2201-2410)
Readkey
readkey
Crt

Readkey

2201-2410)
2201-2410)

More Related Content

Viewers also liked

Grupo Reifs: el Alzheimer
Grupo Reifs: el AlzheimerGrupo Reifs: el Alzheimer
Grupo Reifs: el Alzheimergruporeifs
 
Definicionesdematrimonio
DefinicionesdematrimonioDefinicionesdematrimonio
DefinicionesdematrimonioHumor Basura
 
Eternabond Double Stick Roof Tape
Eternabond Double Stick Roof TapeEternabond Double Stick Roof Tape
Eternabond Double Stick Roof TapeRoofers World
 
Philosophy for Old Age
Philosophy for Old AgePhilosophy for Old Age
Philosophy for Old AgeCharles Joiner
 
Presentacion redes
Presentacion redesPresentacion redes
Presentacion redesRosi Vallejo
 
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...nayapuma
 
ใบงานที่ 9 เรื่อง ปัญหาและความ
ใบงานที่ 9 เรื่อง ปัญหาและความใบงานที่ 9 เรื่อง ปัญหาและความ
ใบงานที่ 9 เรื่อง ปัญหาและความgunwarz
 
Les Personnes Importantes De La RéVolution FrançAise
Les Personnes Importantes De La RéVolution FrançAiseLes Personnes Importantes De La RéVolution FrançAise
Les Personnes Importantes De La RéVolution FrançAisewvolkman
 

Viewers also liked (16)

Proativo x reativo
Proativo x reativoProativo x reativo
Proativo x reativo
 
Blog (1)
Blog (1)Blog (1)
Blog (1)
 
Grupo Reifs: el Alzheimer
Grupo Reifs: el AlzheimerGrupo Reifs: el Alzheimer
Grupo Reifs: el Alzheimer
 
Definicionesdematrimonio
DefinicionesdematrimonioDefinicionesdematrimonio
Definicionesdematrimonio
 
Sql1
Sql1Sql1
Sql1
 
5
55
5
 
Eternabond Double Stick Roof Tape
Eternabond Double Stick Roof TapeEternabond Double Stick Roof Tape
Eternabond Double Stick Roof Tape
 
Telemóvel..
Telemóvel..Telemóvel..
Telemóvel..
 
English50
English50English50
English50
 
Philosophy for Old Age
Philosophy for Old AgePhilosophy for Old Age
Philosophy for Old Age
 
ปี54
ปี54ปี54
ปี54
 
Presentacion redes
Presentacion redesPresentacion redes
Presentacion redes
 
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...
En el año 3018 existía una ciudad llamada futurama en la que vivía un niño ll...
 
ใบงานที่ 9 เรื่อง ปัญหาและความ
ใบงานที่ 9 เรื่อง ปัญหาและความใบงานที่ 9 เรื่อง ปัญหาและความ
ใบงานที่ 9 เรื่อง ปัญหาและความ
 
Velg sjoveien tromso_tromso_havn
Velg sjoveien tromso_tromso_havnVelg sjoveien tromso_tromso_havn
Velg sjoveien tromso_tromso_havn
 
Les Personnes Importantes De La RéVolution FrançAise
Les Personnes Importantes De La RéVolution FrançAiseLes Personnes Importantes De La RéVolution FrançAise
Les Personnes Importantes De La RéVolution FrançAise
 

More from Ole Kmitl

More from Ole Kmitl (7)

ppt1
ppt1ppt1
ppt1
 
ppt8
ppt8ppt8
ppt8
 
ppt7
ppt7ppt7
ppt7
 
ppt5
ppt5ppt5
ppt5
 
ppt4
ppt4ppt4
ppt4
 
ppt3
ppt3ppt3
ppt3
 
ppt2
ppt2ppt2
ppt2
 

ppt6

  • 2. 1. 1. if...then if ตั ย่ง 1 วอ า ที่ P rogramex_if1; U CT ses R ; V i : integer; ar B egin Clrs cr; W ('Ple s ine i = ;re d (i ); rite ae s rt ') a ln if i>0th nW ('i mreth n1 '); 1 e rite o a 0 re d ; a ln E nd. then ผ ลั ธ์ ไ ล พ ทีด้ ่ if...thensert i = Ple s in ae _ พิ พ์ วเล น้อ ก 1 ห พิ พ์ ข1 ม ตั ข ย ว่า 0 รือ ม เล 0 ค สังที่ ยู่ ลั thenจ ทงา า ่ อห ง ะไม่ า น ถ้ ใส่ตั ข า ก 10โป ก จ า วเล ม ก ว่า รแ รม ะ ทงา งนี้ า นดั im than 10 ore 2201-2410)
  • 3. if...then Else if Else then Else ตั ย่ง 1 วอ า ที่ ผ ลั ธ์ ไ ล พ ทีด้ ่ P rogramex_else1; U CT ses R ; Ple s ine i = ae s rt _ V i : integer; ar พิ พ์ วเล ม ก 1 โป ก จ า ม ตั ข าก ว่า 0 รแ รม ะทงาน i m than 10_ ore B egin Clrs cr; W ('Ple s ine i = ;re d (i ); หาก วเล น้อ ก 1 จ ราก อ วาม rite ae s rt ') a ln ใส่ตั ข ย ว่า 0 ะป ฎข้ ค i lessthanor equal10 if i>0th n 1 e W ('i mreth n1 ') rite o a 0 Els e W ('i lesth no e u l 1 '); rite s a r q a 0 re d ; a ln E nd. if...then..Else 2201-2410)
  • 5. if Case...of ตั ย่ง 1 วอ า ที่ P rogramex_if; U CT ses R ; V Score : integer; ar B egin Clrs cr; W (' ine Yo rSco = ;re d (Sco ); rite s rt u re ') a ln re if (Sco > 8 )a d (Sco < 1 0 th n re =0 n re = 0 ) e W ('Yo rGra eisA'); rite u d if (Sco > 7 )a d (Sco <0 th n re =0 n re 8 ) e W ('Yo rGra eisB'); rite u d if (Sco > 6 )a d (Sco <0 th n re =0 n re 7 ) e W ('Yo rGra eisC'); rite u d if (Sco > 5 )a d (Sco <0 th n re =0 n re 6 ) e W ('Yo rGra eisD ; rite u d ') if (Sco > 0)a d (Sco <0 th n re = n re 5 ) e W ('Yo rGra eisF'); rite u d if (Sco > 0)a d (Sco >0 ) th n re = n re 1 0 e W ('Yo rs reisin rre ; rite u co co ct') re d ; a ln E nd. A , B , C, D ผ ลั ธ์ ไ ล พ ทีด้ ่ F ine Yo rSco = s rt u re _ ค นนม ก ะแ าก ว่าหรือ ากั 80แ ไม่ น100 เท่ บ ต่ เกิ ได้ รดA เก ค นนม ก ะแ าก ว่าหรือ ากั 70แ น้อ ก 80 เท่ บ ต่ ย ว่า ได้ รดB เก ค นนม ก ะแ าก ว่าหรือ ากั 60แ น้อ ก 70 เท่ บ ต่ ย ว่า ได้ รดC เก ค นนม ก ะแ าก ว่าหรือ ากั 50แ น้อ ก 60 เท่ บ ต่ ย ว่า ได้ รดD เก ค นนม ก ะแ าก ว่าหรือ ากั 0แ น้อ ก 50 เท่ บ ต่ ย ว่า ได้ รดF เก 2201-2410)
  • 6. Repeat Until Loop Loop Repeat Until Repeat Until Until 2201-2410)
  • 7. Repeat Until ตั ย่ง1 วอ า P rogramexloop1; U CT ses R ; V k: B ar yte B egin Clrs cr; k:= ; 0 re e t pa k:= 1 k+; W ('T isloop', k); rite his until k=5; readln; E nd. ผ ลั ธ์ ไ ล พ ทีด้ ่ T isislo p h o1 T isislo p h o2 T isloop3 his T isloop4 his T isloop5 his 2201-2410)