Pascal

-

 

1)

 

2) (writeln, write)

 

3) (readln, read)

 

4) (: real, integer )

 

5) (random)

 

6) (goto m)

 

7) (for do)

 

8) (if then)

 

9)

 

10)

 

10.1 ""

10.2 ""

10.3 " "

10.4 " "

 

 

1)

 

uses crt; { }

var { }

c:string; {c }

begin; { }

writeln(' '); { ' '}

readln;

end. { }

 

 

 

 

 

2) (writeln, write)

 

uses crt; { }

var { }

 

begin; { }

 

writeln(' '); { ' ');

 

writeln(100+100); { 2 200 }

readln;

end. { }

 

3) (readln, read)

 

 

uses crt; { }

var { }

c:string; {c }

begin; { }

writeln(' ? '); { ' ? ');

readln (c); { C }

writeln(' ', c); { }

readln;

end. { }

 

4) (: real, integer )

 

uses crt; { }

var { }

c, m:string; {c, m }

a:integer; {a }

p:real; {P }

begin; { }

c:= 461 { C 461 }

m:= { M }

a:=29; { A 29}

p:=3.14; { P 3.14}

write(c, ' ' ); { ' 461');

write(a+1, ' ' ); { '30');

write(m, ' ' ); { ' ');

write(' Pi= ',p ); { ' Pi=3.14);

readln;

end. { }

 

5) (random)

 

uses crt; { }

var { }

a,b,c:integer {a,b,c

begin; { }

a:=random(10) { a 0-10}

b:=random(10)+5 { b 5-15}

c:=10-random(20) { c -10..10}

 

writeln(' a=',a,' b=',b,' c='c); { a,b,c}

readln;

end. { }

 

-----------------------------------------------------------------------------------------------

6) (goto m)

 

uses crt; { }

 

label M; { }

var { }

c:string; {c }

 

begin; { }

writeln(' ? '); { ' ? ');

readln (c); { C }

M: writeln(' ', c); { }

goto M: { M}

end. { }

 

-----------------------------------------------------------------------------------------------

7) (for do)

 

 

uses crt; { }

 

var { }

c:string; {c }

 

begin; { }

writeln(' ? '); { ' ? ');

readln (c); { C }

 

 

for n:=1 to 1000 { 1 1000}

begin; { }

writeln(' ', c); { }

end; { }

 

end. { }

-----------------------------------------------------------------------------------------------

8) (if then)

 

uses crt; { }

 

var { }

c,d:string; {c,d }

 

begin; { }

writeln(' ? '); { ' ? ');

readln (c); { C}

writeln(' ');

readln (d); { C}

 

if d='' then writeln(' ', c){ d='' }

else { ' }

writeln(' ', c);

 

readln;

end. { }

 

 

 

 

 

 

9)

, 10 . .

 

Spis()

-3.2

24

11

-5

1.1

99

1015

3.3

17.2

44

K( )

1

2

3

4

5

6

7

8

9

10

 

uses crt; { }

var { }

k,:integer; {K }

spis:array[1..10] of real; { spis 10 , }

n:real; {N }

 

begin; { }

for k:=1 to 10 do { 1 10}

begin; { }

 

write(' '); { }

readln(n); { n}

spis[k]:=n; { N K 'spis}

end; { }

{------------------------------------- 'spis }

for k:=1 to 10 do { 1 10}

begin; { }

write(' spis [,k,]=,spis[n]); { spis K }

end; { }

end; { }

 

 

10.1 ""

 

uses crt; { }

label M; { }

var { }

s:integer; {s }

 

begin; { }

s:=0; { 0}

M: s:=s+1;

writeln('S='s); { S};

Goto M: { M}

end; { }

---------------------------------------------------------------------------------------------

 

10.2 ""

 

uses crt; { }

label M; { }

var { }

s,n:integer; {s }

 

begin; { }

s:=0; { 0}

write(' '); { }

readln(n); { n}

M: s:=s+n; { }

writeln(' ',s); { S};

Goto M: { M}

end; { }

---------------------------------------------------------------------------------------------

10.3 " "

 

For do

 

uses crt; { }

var { }

k,:integer; {K }

n:real;

 

begin; { }

for k:=1 to 10 do { 1 10}

begin; { }

 

write(' '); { }

readln(n); { n}

 

if (n /3 )=int(n/3) then writeln(' ',n, ' '); { ' ',n, ' '}

end; { }

end; { }

 

 

10.4 " "

10

 

uses crt; { }

var { }

k,:integer; {K }

n:real;

min,max:real; { . min- Max-}

 

begin; { }

for k:=1 to 10 do { 1 10}

begin; { }

 

write(' '); { }

readln(n); { n}

if k=1 then begin; { Min Max . N}

min:=n;

max:=n;

end;

if min>n then min:=n; { Min> , Min }

if max<n then max:=n; { Max< , Max }

end; { }

writeln c = ,Min); { }

writeln( c = ,Max); { }

readln;

end; {

 

 

 

1) 10 . .

2) 10 . .

3) 10 . .

4) 10 . 5.

5) 8

6) (, , , )

7) . ( , . )

8) 30 15 ..+44 .

9) 30 40 ..+44 .

9) 30 9 ..+67



<<