CHỦ ĐỀ 1:
Program De1;
Var N, I, Max : Integer ;
T : array [1.300] of Integer ;
Begin
Write ( ‘Nhap vao so luong hoc sinh :’ ) ;
Readln ( N ) ;
For I : = 1 to N do
Begin
Write ( ‘Tuoi cua hoc sinh thu ’, I , ‘ : ’ ) ;
Readln ( T [ I ] ) ;
End ;
Max : = T [ 1 ] ;
For I : = 2 to N do
If T [ I ] > max then max : = t [ I ] ;
Writeln ( ‘So tuoi lon nhat la : ’ , max ) ;
Readln
End .
BAØI TAÄP PASCAL J CHỦ ĐỀ 1: Program De1; Var N, I, Max : Integer ; T : array [1..300] of Integer ; Begin Write ( ‘Nhap vao so luong hoc sinh :’ ) ; Readln ( N ) ; For I : = 1 to N do Begin Write ( ‘Tuoi cua hoc sinh thu ’, I , ‘ : ’ ) ; Readln ( T [ I ] ) ; End ; Max : = T [ 1 ] ; For I : = 2 to N do If T [ I ] > max then max : = t [ I ] ; Writeln ( ‘So tuoi lon nhat la : ’ , max ) ; Readln End . J CHỦ ĐỀ 2: Program De2 ; Var N, I , J , Max : Integer ; A : = Array [ 1..300 ] of Integer ; Begin Write ( ‘Nhap vao so luong phan tu cua day so :’ ) ; Readln ( N ) ; For I : = 1 to n do Begin Write ( ‘Phan tu thu ’, I , ‘ : ’ ) ; Readln ( A [ I ] ) ; End ; Max : = T [ 1 ] ; For I : = 2 to n do If a [ I ] > max then max : = A [ I ] ; J: = 1 ; For I := 2 to N do if A [ I ] > A [ J ] then J := I ; Writeln ( ‘Gia tri cua phan tu lon nhat la : ’ , Max ); Writeln ( ‘Chi so cua phan tu lon nhat la : ’, J ) ; Readln End . J CHỦ ĐỀ 3: Program De3 ; Var A : Array [ 1..300 ] of Integer ; I , N , Dem : Integer ; S , Tb : real ; Begin Write ( ‘Nhap vao so phan tu : ’ ) ; Readln ( N ) ; S: = 0 ; For I : = 1 to n do Begin Write ( ‘Phan tu thu’ , I , ’ : ’ ) ; Readln ( A [ I ] ) ; S : = S + A [ i ] ; End ; Tb : = S / n ; Dem : = 0 ; For I : = 1 to N do If A [ I ] > Tb then Dem : = Dem + 1 ; Writeln ( ‘Phan tu trung binh la : ’ , tb : 6 : 3 ) ; Writeln ( ‘So phan tu lon hon phan tu trung binh la : ’ , dem ) ; Readln End . J CHỦ ĐỀ 4: Program De4 ; Var A: Array [ 1..300 ] of Integer ; N , I , J , T : integer ; Begin Write ( ‘Nhap vao so phan tu cu day so , N = ’ ) ; Readln ( N ) ; For I : = 1 to N do Begin Write ( ‘Phan tu thu’ , I , ‘ : ’ ) ; Readln ( A [ I ] ) ; End ; For J : = N downto 2 do For I : = 1 to J -1 do If A [ I ] > A [ I +1 ] then Begin T: = A [ I ] ; A[ I ]: = A [ I + 1 ] ; A [ I +1 ] : = T ; End ; Writeln ( ‘Day so duoc sap xep la : ’ ) ; For I : = 1 to n do write ( A[ I ] : 4 ) ; Readln End . J CHỦ ĐỀ 5: Program De5 ; Var B : Array [ 1..9 , 1..10 ] of Integer ; I , J : Integer ; Begin For I : = 1 to 9 do For J : = 1 to 10 do B [ I , J ] : = I * J ; For I : = 1 to 9 do Begin For J : = 1 to 10 write ( B [ I ,J ] : 4 ) ; writeln ; End ; readln End . J CHỦ ĐỀ 6: Program De6 ; Var A , B : String ; Begin Write ( ‘Nhap vao ho ten hoc sinh thu nhat : ’ ) ; Readln ( A ) ; Write ( ‘Nhap vao ho ten hoc sinh thu hai : ’ ) ; Readln ( B ) ; If length ( A ) >= length ( B ) then write ( A ) else write ( B ) ; Readln End . J CHỦ ĐỀ 7: Program De7 ; Var I , K: Byte ; A , B : String ; Begin Write ( ‘Nhap xau : ’ ) ; Readln ( A ) ; K: = length ( A ) B: = ‘ ‘ ; For i:= k downto 1 do If A [ I ] ‘ ‘ then B : = B + A[ I ] ; Writeln ( ‘Xau duoc in la : , B ) ; Readln End . J CHỦ ĐỀ 8: Program De8 ; Type Hocsinh = record; Hoten : String [ 40 ] ; Ngaysinh : String [ 10 ] ; Diachi : String [ 50 ] ; Windows , Word , Excel , Powerpoint : real ; Ketqua : String [ 10 ] ; End; Var Lop : Array [1..60] of Hocsinh ; N , I : Byte ; Begin Write ( ‘So luong hoc sinh trong lop : ‘ ) ; Readln ( N ) ; For I : = 1 to N do Begin Writeln ( ‘Nhap so lieu ve hoc sinh thu ‘ , I , ‘ : ‘ ) ; Writeln ( ‘Ho va ten : ‘ ) ; Readln ( Lop [ I ] . Hoten ) ; Writeln ( ‘Ngay sinh :‘ ) ; Readln ( Lop[ I ] . Ngaysinh ) ; Writeln ( ‘Dia chi : ‘ ) ; Readln ( Lop [ I ] . Diachi ) ; Writeln ( ‘Diem Windows : ‘ ) ; Readln ( Lop [ I ] . Windows ) ; Writeln ( ‘Diem Word : ‘ ) ; Readln ( Lop [ I ] . DiemWord ) ; Writeln ( ‘Diem Excel : ‘ ) ; Readln ( Lop [ I ] . DiemExcel ) ; Writeln ( ‘Diem Powerpoint : ‘ ) ; Readln ( Lop [ I ] . DiemPowerpoint ) ; If ( Lop [ I ] . Windows < 0.5 ) or ( Lop [ I ] . Word + Lop [ I ] . Powerpoint < 1 ) or ( Lop [ I ] . Excel < 1 ) then Lop [ I ] . Ketqua : = ‘Khong Dat‘ else Lop [ I ] . Ketqua : = ‘Dat’; End ; Writeln ( ‘Danh sach ket qua hoc sinh trong lop la:‘ ); For I : = 1 to N do Writeln ( ‘Lop [ I ] . Ho ten : 30,‘ – Ketqua : ‘, Lop [ I ] . Ketqua ) ; Readln End . J CHỦ ĐỀ 9: Program De9 ; Var A , B: Integer ; Procedure Hoandoi ( Var X , Y : integer ) ; Var T : Integer ; Begin T : = X ; X: = Y ; Y: = T ; End ; Begin Write ( ‘Nhap vao hai so nguyen duong : ’ ) ; Readln ( A , B) ; Hoandoi (A ,B) ; Writeln ( ‘Hai so duoc in la : ’, a : 6 , b : 6 ) ; Readln End .
Tài liệu đính kèm: