Informatică, întrebare adresată de Utilizator anonim, 9 ani în urmă

Ma poate ajuta cine cu primele 6 probleme

Anexe:

Răspunsuri la întrebare

Răspuns de stassahul
1
1)var a,b:integer;beginread(a);read(b);if a>b thenbeginfor b:=b to a dobeginif (b mod 2 = 0) then writeln(b);end;end;if a<b thenbeginfor a:=a to b dobeginif (a mod 2 = 0) then writeln (a);end;end;end.

2)var y,x,n:integer;beginread(n);y:=0;for x:=0 to n do beginy += x;end;writeln(y);end.

3)1 varianta :
var y,x,n:integer;beginread(n);for x:=1 to n dobeginif (x mod 2 = 0) then y += x;end;writeln(y);end.

2 varianta:

var x,n:integer;beginread(n);x:=0;repeatif (n mod 2 = 0) then x += n;n -= 1;until n=1;writeln(x);end.var x,n:integer;beginread(n);x:=0;repeatif (n mod 2 = 0) then x += n;n -= 1;until n=1;writeln(x);end.

4)var z,n:real;beginread(n);z:=0;repeatz += 1 / n;n -= 1;until n=0;writeln (z);end.

5)var z,n:real;beginread(n);z:=0;repeatz += 1 / (2*n);n -= 1;until n=0;writeln (z);end.

6)var z,n:real;beginread(n);z:=0;repeatz += 1 / (2*n - 1);n -= 1;until n=0;writeln (z);end.

stassahul: offf....
stassahul: prima var a,b:integer;
begin
read(a);
read(b);
if a>b then
begin
for b:=b to a do
begin
if (b mod 2 = 0) then writeln(b);
end;
end;
if a<b then
begin
for a:=a to b do
begin
if (a mod 2 = 0) then writeln (a);
end;
end;
end.
stassahul: a doua var y,x,n:integer;
begin
read(n);
y:=0;
for x:=0 to n do begin
y += x;
end;
writeln(y);
end.
stassahul: a treia, prima varianta var y,x,n:integer;
begin
read(n);
for x:=1 to n do
begin
if (x mod 2 = 0) then y += x;
end;
writeln(y);
end.
stassahul: a treia, a doua varianta var x,n:integer;
begin
read(n);
x:=0;
repeat
if (n mod 2 = 0) then x += n;
n -= 1;
until n=1;
writeln(x);
end.
stassahul: a patra var z,n:real;
begin
read(n);
z:=0;
repeat
z += 1 / n;
n -= 1;
until n=0;
writeln (z);
end.
stassahul: a cincea var z,n:real;
begin
read(n);
z:=0;repeat
z += 1 / (2*n);
n -= 1;
until n=0;
writeln (z);
end.
stassahul: a sasea var z,n:real;
begin
read(n);
z:=0;repeat
z += 1 / (2*n - 1);
n -= 1;
until n=0;
writeln (z);
end.
Alte întrebări interesante