2. Paskal dasturida quyidagi dasturlarni tuzing:
|
Program chiqarish;
begin
write(‘paskal’);
write(‘dasturlash’);
write(‘tili’);
end.
|
Ekranga familiyangiz, ismingiz va Otangizni ismini chiqaruvchi dastur tuzing.
|
|
Program chiqarish;
Var a,b:integer;
begin
a:=21; b:=46;
s:=a+b;
write(‘s=’,s);
end.
|
a va b harflariga ixtiyoriy son berib, S=a*b, s=a/b, s=a-b ifodalar uchun dastur tuzing.
|
|
Program chiqarish;
Var a,b:integer;
begin
writeln(‘a ni kiritng=’);
readln(a);
writeln(‘b ni kiritng=’);
readln(b);
S:=a+b;
write(‘s=’,s);end.
|
Tomonlari a,b,c bo’lgan uchburchakning perimetrini hisoblovchi dastur tuzing.
|
3.Paskalda quyidagicha ekran bilan ishlash operatorlariga oid dasturlarni tuzing:
|
Ekranga familiyangizni yashil rangda chiqaruvchi dastur tuzing.
|
Ekranga familiyangizni havorang, Ismingizni och qizil va otangizni ismini sariq rangda chiqaruvchi dastur tuzing.
|
Program yashil_fam;
Uses Crt;
Begin
TextColor(Green);
Writeln(’Familiya’);
End.
|
|
Ekranga familiyangizni qizil rangda va yashil fonda chiqaruvchi dastur tuzing.
|
Ekranga familiyangizni havorang sariq fonda, Ismingizni och qizil billr fonda va otangizni ismini jigarrang sariq fonda chiqaruvchi dastur tuzing.
|
Program yashil_fon;
Uses Crt;
Begin
TextColor(4); TextBackGround(2);
Writeln(’Familiya’);
End.
|
|
Tozalangan yashil fonli ekranning o`rtasidan familiyangizni qizil rangda chiqaruvchi dastur tuzing.
|
Tozalangan yashil fonli ekranning o`rtasidan familiyangizni qizil rangda, chap pastki burchakdan ismingizni siyohrangda, o`ng quyi burchakda otangizni ismini ko’k rangda chiqaruvchi dastur tuzing.
|
Program toza_ekran;
Uses Crt;
Begin
TextColor(4); TextBackGround(2);
ClrScr;
GoToXY(22,12);
Writeln(’Familiya’);
End.
|
2-TOPSHIRIQ:
1. Paskal dasturida quyidagi tarmoqlanuvchi dasturlarni tuzing:
|
Kiritilgan son 25 da katta bo`lsa, “katta”, aks holda ”kichik” degan yozuvni chiqaradigan dastur tuzing.
|
Kiritilgan son yoshingizdan katta bo`lsa, “katta”, aks holda ”kichik” degan yozuvni chiqaradigan dastur tuzing.
|
Program taqqoslash;
Var a:real;
Begin
If a>25 then writeln(‘katta’) else
Writeln(‘kichik’);
End.
|
|
|
Parol to`g’ri kiritilganligini tekshiruvchi dastur tuzing
( parol=”informatika”)
|
Ismingizni to`g’ri kiritilganligini tekshiruvchi dastur tuzing.
|
Program Parolni_tekshirish;
Var parol:String;
Begin
Write(‘parolni kiritng:’)Readln(parol);
If parol=’informatika’ then
writeln(‘parol tugri’) else
Writeln(‘parol notugri’);End.
|
|
2. Paskal dasturida quyidagi takrorlanuvchi dasturlarni tuzing:
|
Ekranga ”Informatika” so`zini 20 marta chiqaruvchi dastur tuzing:
|
Ekranga familiya va ismingizni 10 marta chiqaruvchi dastur tuzing:
|
Program takrorlash;
Var i: integer;
Begin
For i:=1 to 20 do
Writeln(‘Informatika’);
end.
|
|
|
Tasodifiy sonlar generatori (Ramdom)dan foydalanib, ekranga har xil rangda “A” harfini chiqaruvchi dastur tuzing. Qizil rangli A chiqishi bilan dastur ishi yakunlansin.
|
Tasodifiy sonlar generatori (Ramdom)dan foydalanib, ekranga har xil rangda “A” harfini chiqaruvchi dastur tuzing.Qizil rangli A chiqishi bilan dastur ishi yakunlansin.
|
Program Rangli_harflar;
Var rang:integer;
Begin
Randomize;
Repeat
Rang:=Round(Random(15));
TextColor(rang);
Write(‘A’);
Until rang=4;
End.
|
|
3. Paskal dasturida quyidagi dasturlarni tuzing:
|
Quyidagi amallar bajarilgach, uning qiymatini aniqlang. Bunda s=”Informatika”
|
|
a) Concat(‘o’,’na’);
b)a:=’dunyo’; Length(a);
c)Pos(‘o’,’bahor’);
d)delete(s,6,4);
e)Copy(‘kino’,1,2)+copy(‘oftob’,3,3);
|
|
2.
|
Berilgan ”mustaqil”,”Uzbekiston”, ”davlat” so`zlaridan ”Uzbekiston mustaqil davlat” iborasini hosil qiluvchi dastur tuzing.
|
Berilgan ”Familiya”,”Ism”, ”sharif” so`zlaridan ”Familiya ism sharif” iborasini hosil qiluvchi dastur tuzing.
|
Program suz_yasash;
Const a=’mustaqil’, b=’Uzbekiston’,c=’davlat’;
Var d: String;
d:=Concat(b,a,c); Writeln(d); end.
|
|
3.
|
Kiritilgan so`zni teskarisiga o`girib beruvchi dastur tuzing. M: “ota” so`zidan “ato” so`zini.
|
|
Program teskari;
Var a,b: String; i,len:integer; belgi: char;
begin
write(’suz kiriting:’); readln(a);
Len:=Length(a);
for i:=1 to len do
begin
belgi:=Copy(ai,1);
b:=belgi+b;
end;
write(b);end.
|
|
4.
|
Berilgan ”Saodat” va ”Qadoq” so`zlaridan ”Sadoqat” so`zini yasovchi dastur tuzing.
|
Berilgan ”Informatsiya” va ”Kibernetika” so`zlaridan ”Informatika” so`zini yasovchi dastur tuzing.
|
Program suz_yasash;
Var a,b:String;
begin
a:=’saodat’; b:=’qadoq’;
Delete(a,3,2);
Delete(b,1,2);
Insert(b,a,3);
Writeln(a);
end.
|
|
5.
|
Berilgan so`zning belgilari orasiga bittadan probel qo`shib chiquvchi dastur tuzing.
|
|
Program probel;
Uses crt;
Var a: String; i:integer;
Begin
ClrScr;
Write('suzni kiriting=');read(a);
For i:=1 to length(a) do
Begin
write(a[i],' ');
End;end.
|
|
4.Paskal dasturida quyidagi dasturlarni tuzing:
|
Uchlarining koordinatalari (10,10) va (630,470) bo`lgan sariq fonli ko`k rangli kesma tasvirini chizish dasturini tuzing.
|
Paskal dasturida quyidagi shaklni chizish dasturini tuzing:
|
Program kesma;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetBKColor(Yellow);SetColor(Blue);
Line(10,10,630,470);
end.
|
|
2.
|
Markazi (300,200) nuqtada radiusi 100 bo`lgan yashil rangli aylana tasvirini chizish dasturini tuzing.
|
Program aylana;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetBKColor(Yellow);SetColor(Green);
Circle(3000,2000,100);
end.
|
3.
|
Chap yuqori burchagi(10,10) o`ng quyi burchagi (200,100) nuqtalarda bo`lgan ko`k rangli to`gri to`rtburchak tasvirini chizish dasturini tuzing.
|
Program turtburchak;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetBKColor(7);SetColor(1);
Rectangle(10,10,200,100);
end.
|
5. Paskal dasturida quyidagi dasturlarni tuzing:
1.
|
Ichi qizil rangli qali gorizontal chiziqlar bilan to`ldirilgan to`g’ri to`rtburchak tasvirini chizish dasturini tuzing.
|
Paskal dasturida quyidagi shaklni chizish dasturini tuzing:
|
Program qizil_ turtburchak;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetFillStyle(2,4);
Bar(10,10,400,300);
end.
|
|
2.
|
Markazi (320,240) nuqtada radiuslari 100 va 200 bo`lgan ichi ko`k rangli o`gma katak chiziqlar bilan to`ldirilgan qizil ellips tasvirini chizish dasturini tuzing.
|
Program yashil_ellips;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetColor(red);
SetFillStyle(8,1);
FillEllipse(320,240,100,200);
end.
|
3.
|
Chap yuqori burchagi(100,100) o`ng quyi burchagi (200,300) nuqtalarda, balandligi 50 bo`lgan qizil rangli parallelepiped tasvirini chizish dasturini tuzing.
|
Svetofor tasvirini chizish dasturini tuzing:
|
Program parallelepiped;
UsesGraph;
var gd,gm:integer;
Begin
Gd:=Detect; InitGraph(gd,gm,’’);
SetColor(red);
SetFillStyle(1,9);
Bar3D(100,100,200,300,50,True);
end.
|
|
2
|
Topshirdi:
|
|
Qabul qildi:
|
|
|
Do'stlaringiz bilan baham: |