0% found this document useful (0 votes)
12 views3 pages

While Si Repeat

Uploaded by

frunza.elena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

While Si Repeat

Uploaded by

frunza.elena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ce se va afișa?

Program p1;
var a: integer;
begin
a := 1;
Repeat
a:=a + 1;
Until a < 20; WriteLn(a); readln; end.

Program p2;
var a ,b: integer;
begin
a := 1; b:=5;
Repeat
a:=a+1;
if a=b then b:=b+5;
Until b > 20; writeln(a); readln;end.

20

Program P4;
var a : integer;
begin
a:= 1;
While a<= 20 Do a := a + 1;
writeln(a);
readln;
end.

21

Program P5;
var a : integer;
begin
a:= 1;
While a>20 Do a := a + 1;
writeln(a);
readln;
end.

Program afisare;
var i : integer;
begin
i := 1;
Repeat
writeln(i);
i:=i + 1;
Until i > 7;
readln;
end.

Numerele până la 7

Program danu;
var i : integer;
begin
i := 1;
Repeat
writeln(i);
i:=i + 1;
Until i > 35;
readln;
end.

Numerele până la 35

Ce va afișa urmatorul program ?


i:=1; n:=2;
repeat write (i,' '); i:=i+1;
until i>n

12

ce va afișa programul?
var a,b:real;
begin
a:=2; b:=1;
while a<=b do
a:=b*0.5;
writeln('a', a:5:2);
readln;
end.

a=2.00
Ce va afișa programul?
var a, b, S:integer; P:real;
begin
a:=1; b:=3; P:=1; S:=0;
repeat
a:=a+1;
until a>b;
P:=P*a;
S:=S+a;
writeln ('P=',P:5:2);
whriteln('S=', S);
readln
end.
P=4.00
S=4

Ce valoare vor primi x, y, z după execuția ciclică?


x:=0; y:=4; z:=13;
repeat
x:=y-1;
y:=x+5;
z:=y+x;
until z>33;
writeln ('x= ',x);
writeln ('y= ',y);
writeln ('z= ',z);

x=15
y=20
z=35

a) i:=1; While i<=4 do begin write(i,' '); i:=i+1; end;

1234

b) De câte ori va repeta programul: write(i,' ')?


i:=1; While i<=8 do begin write(i,' '); i:=i+3; end;

c) x1:=1; x2:=6; dx:=3; x:=x1;


repeat if x>5 then y:=x+6 else y:=x-6;
writeln(x:2,' ',y:2);
x:=x+dx;
until x>x2;

15
4 -2
7 12

You might also like