Documente Academic
Documente Profesional
Documente Cultură
Itemi:
1. Elaborați un program care calculează:
1. ∑ ∏ (i + j);
Programul:
Program ionatan1;
Uses Crt;
Var
i,j: Byte;
Produs,Suma: Double;
Begin
while i<10 do
For i:=1 To 10 Do
Begin
Suma := 1;
For j:=1 To 20 Do
Begin
Produs := Produs*(i+j);
End;
repeat
Suma := Suma+Produs;
until Suma = 1 ;
End;
Writeln(' Rezulatul este ',Suma);
End.
Consola:
Output:
Rezulatul este 1.00000000000000E+000
Schema logica:
Start
Uses Crt
Citeste i,j
Produs := Produs*(i+j)
repeat
Suma := Suma+Produs
until Suma = 1
Afiseaza Suma
Stop
program ionatan3;
var a,b,h,x,f:real;
begin
write('a='); readln(a);
write('b='); readln(b);
write('h='); readln(h);
x:=a;
while x<=b do
begin
f:=sqr(x);
x:=ln(x+1);
writeln('x=',x:0:9,'f=':40,f:0:9);
break
end;
end.
Consola:
a=
b=
h=
Output:
a=3
b=4
h=5
x=3.000000000 f=9.000000000
Schema logica:
Start
Citeste a,b,h,x
x:=a
while x<=b do
f:=sqr(x)
x:=ln(x+1)
Afiseaza x, f
Stop
Program folosind repeat:
program ionatan4;
var a,b,h,x,f:real;
begin
write('a='); readln(a);
write('b='); readln(b);
write('h='); readln(h);
x:=a;
repeat
f:=sqr(x);
x:=ln(x+1);
writeln('x=',x:0:9,'f=':40,f:0:9);
break;
until x>b;
end.
Consola:
a=
b=
h=
Output:
a=3
b=2
h=1
x=1.386294361 f=9.000000000
Schema logica:
Start
Citeste a,b,h,x
x:=a;
repeat
f:=sqr(x)
x:=ln(x+1)
Afiseaza x, f
Stop