Mavzuni mustaxkamlash uchun topshiriqlar
1. Quyidagi operatorlardagi xatolarni aniqlang va izohlang.
a) for 1= -15 to 5 do s:=s+I;
b) for kub:= 100/10+11 to 1963 do begin a:=7;end;
d) for mag:=99 dawnto 1 do readl(aa);
e) for bma:= 0.5 to 10 do writeln(k);
2. Quyidagi operatorlardagi takrorlanishlar sonini aniqlang.
a) for k:=trunc(23/5) downto trunc(l/2) do m:=1991;
b) for s:=23 to 1 do m:=1963;
d) for J:=2 downto 19 do m:=1950;
e) for d:=23 downto 1 do m:=2009;
f) for i:=abs(~25) to 25 do s:=s+i*i;
g) for h:=round(9.6) downto trunc(3*3) do a:=21;
3. S=10+12+14+...+50 yig'indining hisoblash dasturini tuzing.
Program masala_3;
Uses Crt;
Var s:integer;
Begin
S:=0;
For i:=10 to 50 do If not(odd(I)) then s:=s+ I;
Writeln(‘ y=’,y );
Readln ;
End.
5. P= 1·3·5·...·23 ko'paytmaning hisoblash dasturini tuzing.
Program masala_5;
Uses Crt;
Var p, i:integer;
Begin p:=1;
For i:=1 to 23 do if odd(I) then p:=p*I;
Writeln(‘p=’,p);
Readln ;
End.
6. A[1..5] massiv berilgan. Massiv elementlarini teskari tartibda chiqaruvchi dastur tuzing.
Program masala_6;
Uses Crt;
Var i: integer; a: array[1..17]of real;
Begin
For i:=1 to 17 do
Begin writeln(i,’-elementni kiriting=’); Readln(a[i]) ; end;
Writeln(‘Nolga teng elementlarning indekslari’);
For i:=5 downto 1 do writeln(‘A[‘,I,’]=’,A[i]); readln;
End.
7. A[1..15] massiv berilgan. Massivning toq indeksli elementlarining yig'indisidan juft indeksli elementlarining yig'indisini ayirib chiqaruvchi dastur tuzing.
Program masala_6;
Uses Crt;
Var s, i: integer; a: array[1..17]of real;
Begin s:=0;
For i:=1 to 115 do if I mod 2=0 then S:=S-A[i] else S:= S+A[I];
Begin writeln(i,’-elementni kiriting=’); Readln(a[i]) ; end;
Writeln(‘S=’,S);
readln;
End.
|