Pascal Örnekleri 7 ( Bloklu yazım örnekleri )

65) 3 blok halinde 12*42=21*24 şeklindeki eşitliği yazan  program.
Çöz:65)uses crt;
var
i,j,a,b,c,d,e,f,sayac:integer;
begin
clrscr; for i:=11 to 99 do
for j:=11 to 99 do begin
a:=j div 10;
b:=j mod 10;
e:=b*10+a;
c:=i div 10;
d:=i mod 10;
f:=d*10+c;
if(i*j=e*f)and((i<>j)and(a<>b)and(c<>d))and(a<>d)then
begin
sayac:=sayac+1;
if(sayac<=24)then
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f)
else if(sayac<=48)then begin
gotoxy(20,sayac-24);
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f);end
else if(sayac<=72)then begin
gotoxy(40,sayac-48);
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f);end;end;
end;
readln;
end.

66)3 bloklu olup istediğimiz blokta kırılan 12*42=24*21 eşitliğini yazan program.
Çöz:66)uses crt;
var
i,j,a,b,c,d,e,f,sayac:integer;
begin
clrscr;
for i:=11 to 99 do begin
if(sayac>24)then break;
for j:=11 to 99 do
begin
a:=j div 10;
b:=j mod 10;
e:=b*10+a;
c:=i div 10;
d:=i mod 10;
f:=d*10+c;
if(i*j=e*f)and((i<>j)and(a<>b)and(c<>d))and(a<>d)then
begin
sayac:=sayac+1;
if(sayac<=24)then
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f)
else if(sayac<=48)then begin
gotoxy(20,sayac-24);
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f);end
else if(sayac<=72)then begin
gotoxy(40,sayac-48);
writeln(‘  ‘,i,’*’,j,’=’,e,’*’,f);end;
end;
end;end;
readln;
end.

67)Girilen ismin tersini yazan program.
Çöz:67)uses crt;
var
i,x:integer;
ad,isim:string;
begin
clrscr;
readln(isim);
x:=length(isim);
for i:=x downto 1 do
begin
ad:=copy(isim,i,1);
write(ad:5);
end;
readln;
end.

68) İsim
sim
im
m     şeklinde yazan program.
Çöz:68)uses crt;
var
i,x:integer;
ad,isim:string;
begin
clrscr;
writeln(‘İsmi gir:’); readln(isim);
x:=length(isim);
for i:=1 to x do
begin
ad:=copy(isim,i,x);
writeln(ad:5);
end;
readln;
end.
69) misİ
mis
mi
m             şeklinde ters yazan program.
Çöz:69)uses crt;
var
a,ad:string;
z,y,x:integer;
begin
clrscr;
writeln(‘adınızı giriniz:’);readln(a);
clrscr;
x:=length(a);
for y:=1 to x do
begin
gotoxy(x,y);
for z:=x downto y do
begin
ad:=copy(a,z,1);
write(ad:1);
end;
writeln(”);
end;
readln;
end.

70)Üçgen şeklinde ismi ve tersini azaltarak yazan program.
Çöz:70)uses crt;
var
a,ad:string;
y,z,x,i:integer;
begin
clrscr;
readln(a);
clrscr;
x:=length(a);
for y:=1 to x do begin
gotoxy(x,y);
for z:=x downto y do begin
ad:=copy(a,z,1);
write(ad:1);
end;
writeln(‘  ‘);
end;
gotoxy(1,1);
for i:=1 to x do begin
ad:=copy(a,i,x);
writeln(ad:6);end;
readln;
end.

Yazar: kacarozgur

Özgür Kaçar sitemizde 38 yazı eklemiş...

Share