While do
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

WHILE..DO PowerPoint PPT Presentation


  • 30 Views
  • Uploaded on
  • Presentation posted in: General

WHILE..DO. คำสั่งควบคุมให้ทำงานซ้ำ โดยที่ต้องตรวจสอบเงื่อนไขก่อนที่จะทำ ทำซ้ำจนกว่าเงื่อนไขเป็นจริง โดยไม่ได้กำหนดว่าต้องทำกี่รอบ เมื่อใดก็ตามที่เงื่อนไขที่ทดสอบผลออกมาเป็นเท็จ ก็จะหยุดการทำงานซ้ำ ผ่านไปที่คำสั่งถัดไป

Download Presentation

WHILE..DO

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


While do

WHILE..DO


While do

While Do

Begin

Statement;

Statement;

:

Statement;

End;


While do

PROGRAM while_II;

VAR COUNT : INTEGER;

BEGIN {MAIN}

COUNT := 1;

WHILE COUNT <=5 DO

BEGIN

WRITELN(I AM COMPUTER);

COUNT := COUNT+1;

END;

Write(False);

END.


While do

0

PROGRAM WHILE_1;

Uses wincrt;

VAR I, N : INTEGER;

BEGIN

I := 0;

WRITE();READLN(N):

WHILE I <= N DO

BEGIN

Write(I, );

I := I+1;

END;

END.


While do

SUCC 1

PRED

PROGRAM WHILE_II;

Uses wincrt;

VAR CH : CHAR;

BEGIN {MAIN}

CH := A;

WHILE CH <= Z DO

BEGIN

Writeln(Ch);

CH := Succ(Ch);

END;

END.


While do

1-10

PROGRAM WHILE_Couple;

Uses wincrt;

VAR J : Integer;

BEGIN {MAIN}

J := 2;

WHILE J <= 10 DO

BEGIN

Write(j, );

J:=J+2;

END;

END.


While do

1-10

PROGRAM WHILE_Sum;

Uses wincrt;

VAR J,Sum : Integer;

BEGIN {MAIN}

J := 1;Sum :=0;

WHILE J <= 10 DO

BEGIN

Sum := Sum+J;

Write(j, );

J:=J+1;

END;

WriteLn;

WriteLn(result 1..10 is ,sum);

END.


While do

1-10

PROGRAM WHILE_Average;

Uses wincrt;

VAR J,Sum,N : Integer;

Average1 : Real;

BEGIN {MAIN}

J := 1;Sum :=0;N:=0;

WHILE J <= 10 DO

BEGIN

Write(J,' ') ;

Sum := Sum+J;

J:=J+2;

n:=n+1;{check round}

END;

WriteLn;

Average1 := Sum/n;

WriteLn('result sum1..10 is ',sum);

WriteLn('result average 1..10 is ',Average1:5:2);

End.


While do1

While DO

  • Z A While Do

  • .. 2546 .. ( ..) .. 2546 .. 2546 . 2546

  • 20-30 ( While DO)

  • 20-30 ( While DO)

  • ( While DO) 1 3 5 7 9

  • 250 10 250, 240, 230 ...10

  • 10-100 5


  • Login