Паскалдан жиі ?олданыста?ы та?ырыпты? есептер. Барл?ы 40 есеп ж?не барлы? есепті? паскаль тіліндегі шешуілері берілген.
№1 Кез келген екі ?лшемді массивті? е? ?лкен элементін табу программасын к?р.
Program m1;
Var A:array [1.100,1.100] of integer;
n,m,i,j,max:integer;
Begin
Writeln(‘массив элементiн енгiз’);
readln(n,m);
randomize;
For i:=1 to n do
for j:=1 to m do
A [i,j]:=-25+random(100);
For i:=1 to n do Begin
writeln;
For j:=1 to m do
write (A[i,j]:4); end;
max:=A[1,1];
For i:=1 to n do
For j:=1 to n do
if A[i,j]>max then max:=A[i,j];
writeln;
writeln (‘max=’,max:5);
readln
end.
Вы уже знаете о суперспособностях современного учителя?
Тратить минимум сил на подготовку и проведение уроков.
Быстро и объективно проверять знания учащихся.
Сделать изучение нового материала максимально понятным.
Избавить себя от подбора заданий и их проверки после уроков.
Просмотр содержимого документа
«Паскалдан жиі ?олданыста?ы та?ырыпты? есептер »
Паскалдан жиі қолданыстағы тақырыптық есептер
Тлеубаева Гүлмира Қайроллақызы
информатика пәнінің мұғалімі
Паскалдан жиі қолданыстағы тақырыптық есептер. Барлғы 40 есеп және барлық есептің паскаль тіліндегі шешуілері берілген.
№1 Кез келген екі өлшемді массивтің ең үлкен элементін табу программасын кұр.
Program m1; Var A:array [1..100,1..100] of integer; n,m,i,j,max:integer; Begin Writeln(‘массив элементiн енгiз’); readln(n,m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; max:=A[1,1]; For i:=1 to n do For j:=1 to n do if A[i,j]max then max:=A[i,j]; writeln; writeln (‘max=’,max:5); readln end.
Program E2; Var A: array [1..100, 1..100] of integer; i,n,m,j,k:integer; begin randomize; writeln(‘massiv olhemin engiz’); Readln(n,m); For i:=1 to n do For j:=1 to m do A[i,j]:=-25+random(100); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; k:=0; for i:=1 to n do for j:=1 to m do if A[i,j]0 then k:=k+1; writeln; writeln(‘он элементтер саны=’,k); Readln end.
Program m3; Var A:array [1..100,1..100] of integer; n,m,i,j,min,k,l:integer; Begin Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; min:=A[1,1]; For i:=1 to n do begin For j:=1 to n do if A[i,j]writeln; writeln (‘min=’,min:5, ‘ jol=’,k,’ bagan=’,l); readln end.
Program E4; Var A: array [1..100, 1..100] of integer; i,n,m,j,k:integer; begin randomize; Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); for i:=1 to n do For j:=1 to m do A[i,j]:=-5+random(10); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; k:=1; for i:=1 to n do for j:=1 to m do if A[i,j]writeln; writeln(‘teris elementter kobeitindisi=’,k); Readln end. №5 Кезкелгенсөздіенгізгенде , солсөздікеріретпеншығаратынпрограммақұр
Program E5; var x,d,a:string; i,k:integer; Begin Writeln(‘soz engiz’); Readln(x); for i:=length(x) downto 1 do write( copy(x,i,1)); Readln end.
№6 Үш санның арифметикал қ ортасын табатын программаны құр.
program esep; var x,y,z,S:real; begin writeln(‘x,y,z engiz’); readln (x,y,z); S:=(x+y+z)/3; writeln(‘S=’,S:2:4); readln; end. №7 Кезкелгенекіөлшемдімассивтіңәрбірбағанындағыоңэлементтердіңқосындысынтап, бірөлшемдімассивқұр
var s,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘massiv olshemin engiz’); readln(n); for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin s:=0; for i:=1 to n do if 0end; end; writeln; writeln; for j:=1 to n do write (b[j]:5); readln end. №8. Бірөлшемдімассивтіңэлементтерініңқосындысынтабатынпрограммақұру;
Program m8; uses crt; var i,n:integer; sum:real; a: array [1..100] of integer; begin Randomize; Writeln(‘массив элементин енгиз’); readln(n); for i:=1 to n do a[i]:=-25+random(100); for i:=1 to n do write(a[i]:5); sum:=0; for i:=1 to n do sum:=sum+a[i]; writeln(”); writeln(‘сандардын косындысы=’,sum:6:2); readln end. №9 Кезкелгенекіөлшемдімассивтіңеңүлкенэлементінтабупрограммасынкұр.
Program m9; Var A:array [1..100,1..100] of integer; n,m,i,j,max:integer; Begin Writeln(‘массив элементiн енгiз’); readln(n,m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; max:=A[1,1]; For i:=1 to n do For j:=1 to n do if A[i,j]max then max:=A[i,j]; writeln; writeln (‘max=’,max:5); readln end.
Program m3; Var A:array [1..100,1..100] of integer; n,m,i,j,min,k,l:integer; Begin Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; min:=A[1,1]; For i:=1 to n do begin For j:=1 to n do if A[i,j]writeln; writeln (‘min=’,min:5, ‘ jol=’,k,’ bagan=’,l); readln end.
Program m11; Var A:array [1..100,1..100] of integer; n,m,i,j,max,k,l:integer; Begin Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; max:=A[1,1]; For i:=1 to n do begin For j:=1 to n do if A[i,j]max then begin max:=A[i,j]; k:=i;l:=j; end;end; writeln; writeln (‘max=’,max:5, ‘ jol=’,k,’ bagan=’,l); readln end.
№12. Кез – келгенбірөлшемдімассивтіңеңүлкенэлементініңиндексінтабупрограммасынқұру;
program m8; uses crt; var k,i,n,max:integer; a: array [1..100] of integer; begin Randomize; Writeln(‘массив элементин енгиз’); readln(n); for i:=1 to n do a[i]:=-20+random(100); for i:=1 to n do write(a[i]:5); max:=a[1]; for i:=1 to n do if a[i]max then begin max:=a[i];k:=i; end; writeln(”); writeln(‘ индекси ‘,k); readln end.
Program e13; uses crt; var s:string; procedure changechar(var s:string); var n:byte; begin n:=0; while pos (‘a’,s)0 do begin n:=n+1; S[pos('a',s)]:=’o'; end; end; begin writeln; write(‘s=’); readln(s); changechar(s); writeln(‘ а-ны о-га ауыстыргандагы нәтиже: ‘,s); readln end.
№14 Енгізілген сөздегі барлық “л” әріптерін санайтын программа құр Program E14; var x,d,a:string; i,k:integer; Begin Writeln(‘soz engiz’); Readln(x); k:=0; for I:=1 to length(x) do Begin d:=copy(x,i,1); if d=’L’ then k:=k+1; end; Writeln ( ‘kezdesetin L cani=’, k); Readln end.
Program E15; Var A: array [1..100, 1..100] of integer; i,n,m,j,k:integer; begin randomize; writeln(‘massiv olhemin engiz’); Readln(n,m); For i:=1 to n do For j:=1 to m do A[i,j]:=-25+random(100); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; k:=0; for i:=1 to n do for j:=1 to m do if A[i,j]writeln; writeln(‘терис элементтер саны=’,k); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; Readln end.
Program E2; Var A: array [1..100, 1..100] of integer; i,n,m,j,k:integer; begin randomize; writeln(‘massiv olhemin engiz’); Readln(n,m); For i:=1 to n do For j:=1 to m do A[i,j]:=-25+random(100); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; k:=0; for i:=1 to n do for j:=1 to m do if A[i,j]0 then begin A[i,j]:=0; k:=k+1; end; writeln; writeln(‘он элементтер саны=’,k); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; Readln end.
Program e17; var i,n:integer; A:array [1..100] of integer; Kob:integer; begin Randomize; writeln(‘massiv olshemin engiz’); readln(n); for i:=1 to n do a[i]:=random(9); for i:=1 to n do write(a[i]:5); kob:=1; for i:=1 to n do kob:=A[i]*kob; writeln(”); writeln(‘kob=’, kob); readln end.
Program e18; Var i,j,n,S:integer; a:array[1..50,1..50] of integer; Begin writeln (‘massiv olshemin engiz’); readln(n); for i:=1 to n do for j:=1 to n do a[i,j]:=random(50); for i:=1 to n do begin writeln; for j:=1 to n do write(a[i,j]:4); end; S:=0; for i:=1 to n do for j:=1 to n do if i=j then S:=S+a[i,j]; writeln; writeln (‘S=’,S:4); readln End.
Program m11; Var A:array [1..100,1..100] of integer; n,m,i,j,max,k,l:integer; Begin Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; max:=A[1,1]; For i:=1 to n do begin For j:=1 to n do if A[i,j]max then begin max:=A[i,j]; k:=i;l:=j; end;end; writeln; writeln (‘max=’,max:5, ‘ jol=’,k,’ bagan=’,l); readln end.
Program E4; Var A: array [1..100, 1..100] of integer; i,n,m,j,k:integer; begin randomize; Writeln(‘massiv olshemderin engiz’); Writeln(‘jol olshemin engiz’); readln(n); Writeln(‘bagan olshemin engiz’); readln(m); for i:=1 to n do For j:=1 to m do A[i,j]:=-5+random(10); For i:=1 to n do begin writeln; for j:=1 to m do write (A[i,j]:5); end; к:=1; for i:=1 to n do for j:=1 to m do if A[i,j]writeln; writeln(‘teris elementter kobeitindisi=’,k); Readln end.
var s,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘massiv olshemin engiz’); readln(n); for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin s:=0; for i:=1 to n do if 0end; end; writeln; writeln; for j:=1 to n do write (b[j]:5); readln end.
uses crt; var i,j,n,minG,maxG,max,min:integer; a:array[1..50] of integer; begin clrscr; randomize; write(‘massiv jol sani? n= ‘); readln(n); write(‘berilgen massiv ‘); for i:=1 to n do a[i]:=random(100); for i:=1 to n do write(a[i],’ ‘); writeln; max:=a[1]; min:=a[1]; for i:=1 to n do begin if maxif mina[i] then begin min:=a[i]; ming:=i end; end; a[maxg]:=min; a[ming]:=max; writeln(‘natije’); for i:=1 to n do begin write (a[i], ‘ ‘); end; readln end.
Program m23; Var A:array [1..100,1..100] of integer; n,m,i,j,max:integer; Begin Writeln(‘массив элементiн енгiз’); readln(n,m); randomize; For i:=1 to n do for j:=1 to m do A [i,j]:=-25+random(100); For i:=1 to n do Begin writeln; For j:=1 to m do write (A[i,j]:4); end; max:=A[1,1]; For i:=1 to n do For j:=1 to n do if A[i,j]max then max:=A[i,j]; writeln; writeln (‘max=’,max:5); readln end.
var s,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘massiv olshemin engiz’); readln(n); for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin s:=0; for i:=1 to n do if 0end; end; writeln; writeln; for j:=1 to n do write (b[j]:5); readln end.
uses crt; var i,j,n,k,s:integer; a:array[1..50,1..50] of integer; begin clrscr; writeln; write(‘macciv olshemin engiz n= ‘); readln(n); randomize; for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write (a[i,j]:5); end; k:=n; s:=0; for i:=1 to n do if a[i,k]0 then s:=s+a[i,k]; writeln; writeln(‘elementter kocindici ‘,k,’ bagan= ‘,s); repeat until keypressed; end.
uses crt; var i,j,n,k,s:integer; a:array[1..50,1..50] of integer; begin clrscr; writeln; write(‘macciv olshemin engiz n= ‘); readln(n); randomize; for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write (a[i,j]:5); end; k:=2; s:=0; for i:=1 to n do if a[i,k]writeln; writeln(‘songi bagan elementter kosindici ‘,k,’ bagan= ‘,s); repeat until keypressed; end.
uses crt; var i,j,n,k,s:integer; a:array[1..50,1..50] of integer; begin clrscr; writeln; write(‘macciv olshemin engiz n= ‘); readln(n); randomize; for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write (a[i,j]:5); end; k:=n; s:=0; for i:=1 to n do if a[i,k]writeln; writeln(‘elementter kocindici ‘,k,’ bagan= ‘,s); repeat until keypressed; end.
uses crt; var i,j,n,k,s:integer; a:array[1..50,1..50] of integer; begin clrscr; writeln; write(‘macciv olshemin engiz n= ‘); readln(n); randomize; for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write (a[i,j]:5); end; k:=n; s:=1; for i:=1 to n do if a[i,k]writeln; writeln(‘songi bagan elementter kobeitindici ‘,k,’ bagan= ‘,s); repeat until keypressed; end.
program e29; var max,m,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘m jol element sanin engiz’); readln(m); writeln(‘n bagan sanin engiz’); readln(n); for i:=1 to m do for j:=1 to n do a[i,j]:=random(100); for i:=1 to m do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for i:=1 to m do begin max:=a[i,1]; for j:=1 to n do if maxend;end; writeln; writeln; for i:=1 to m do write (b[i]:6); readln end.
program e30; var max,m,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘m jol element sanin engiz’); readln(m); writeln(‘n bagan sanin engiz’); readln(n); for i:=1 to m do for j:=1 to n do a[i,j]:=random(100); for i:=1 to m do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin max:=a[1,j]; for i:=1 to m do if maxend;end; writeln; writeln; for j:=1 to n do write (b[j]:6); readln end.
var s,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘massiv olshemin engiz’); readln(n); for i:=1 to n do for j:=1 to n do a[i,j]:=-20+random(100); for i:=1 to n do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin s:=0; for i:=1 to n do if 0end; end; writeln; writeln; for j:=1 to n do write (b[j]:5); readln end.
program e32; var min,m,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘m jol element sanin engiz’); readln(m); writeln(‘n bagan sanin engiz’); readln(n); for i:=1 to m do for j:=1 to n do a[i,j]:=random(100); for i:=1 to m do begin writeln; writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin min:=a[1,j]; for i:=1 to m do if min=a[i,j] then begin min:=a[i,j]; b[j]:=min; end;end; writeln; for j:=1 to n do writeln (b[j]); readln end.
program e33; var min,m,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘m jol element sanin engiz’); readln(m); writeln(‘n bagan sanin engiz’); readln(n); for i:=1 to m do for j:=1 to n do a[i,j]:=random(100); for i:=1 to m do begin writeln; for j:=1 to n do write(a[i,j]:5); end; for i:=1 to m do begin min:=a[i,1]; for j:=1 to n do if min=a[i,j] then begin min:=a[i,j]; b[i]:=min; end; end; writeln; writeln; for i:=1 to m do write (b[i]:5); readln end.
program e32; var min,m,n,i,j:integer; a:array[1..100,1..100] of integer; b:array[1..100] of integer; begin writeln; randomize; writeln (‘m jol element sanin engiz’); readln(m); writeln(‘n bagan sanin engiz’); readln(n); for i:=1 to m do for j:=1 to n do a[i,j]:=random(100); for i:=1 to m do begin writeln; writeln; for j:=1 to n do write(a[i,j]:5); end; for j:=1 to n do begin min:=a[1,j]; for i:=1 to m do if min=a[i,j] then begin min:=a[i,j]; b[j]:=min; end;end; writeln; for j:=1 to n do writeln (b[j]); readln end.
Program e13; uses crt; var s:string; procedure changechar(var s:string); var n:byte; begin n:=0; while pos (‘р’,s)0 do begin n:=n+1; S[pos('р',s)]:=’o'; end; еnd; begin writeln; write(‘s=’); readln(s); changechar(s); writeln(‘ а-ны о-га ауыстыргандагы нәтиже: ‘,s); readln end.
№36 а нақты сан берілген. сандарының арасынан а-дан кіші болатын сандарды экранға шығар.
program cb; uses crt; var a, sum:real; n:longint; begin clrscr; writeln(‘san engiz’); readln (a); n:=1; sum:=0; while sumbegin sum:=sum+1/n; if sumn:=n+1; end; readln; end.
program cb; uses crt; var a, sum:real; n:longint; begin clrscr; writeln(‘san engiz’); readln(a); n:=1; sum:=0; while sumbegin sum:=sum+1/n; if sumn:=n+1; end; readln; end.
Program sa; uses crt; var a:array[1..9] of integer; arif,s:real; j,i:integer; begin clrscr; writeln(‘engiz’); for i:=1 to 9 do begin write(‘b[',i,']=’); readln(a[i]); end; s:=0; j:=0; for i:=1 to 9 do begin if a[i]=10 then begin s:=s+a[i]; j:=j+1 end; end; if j=0 then writeln(‘Onnan ulken san zhok ‘) else begin arif:=s/j; writeln(‘arifmetikalik ortasi=’,arif:5:1); end; readln end.
Program sa; uses crt; var a:array[1..9] of integer; arif,s:real; j,i:integer; begin clrscr; writeln(‘engiz’); for i:=1 to 9 do begin write(‘b[',i,']=’); readln(a[i]); end; s:=0; j:=0; for i:=1 to 9 do begin if a[i] mod 20 then begin s:=s+a[i]; j:=j+1 end; end; if j=0 then writeln(‘Tak san zhok ‘) else begin arif:=s/j; writeln(‘arifmetikalik ortasi=’,arif:5:1); end; readln end.