Bài 1

Reviews
Bài 1: a) Viết chương trình nhập vào số tự nhiên n và tính tổng sau : T = 1/1 + 1/2 + ... + 1/n b) Nhập vào số tự nhiên m và tìm số tự nhiên n lớn nhất sao cho : T = 1/1 + 1/2 +.....+ 1/n <= m Bài 2 : Liên kết Bộ ba số tự nhiên n,m,k theo thứ tự đó đuợc gọi là liên kết khi ước chung lớn nhất của m và n là ước chung lớn nhất của m và k. Viết chương trình nhập vào ba số n,m,k và cho biết ba số theo thứ tự đó có phải là liên kết hay khôg? VD : ba số 8 ; 12 ; 24 là liên kết vì UCLN(8,12) = 4 là ước của UCLN(12,24) = 12. Bộ ba số 24 ; 12 ; 8 không là liên kết Program lienket; Uses Crt; Var m,n,k,u,v:word; {---------------------------------------------------------} Function ucln(a,b:word):word; Var x,y:word; Procedure biendoi(var x,y:word); Var t:word; Begin While y<>0 do begin If y>x then begin y:=y-x;biendoi(x,y); end else begin t:=x-y;x:=y;y:=t;biendoi(x,y) end end; End; Begin x:=a;y:=b; biendoi(x,y); Writeln('UCLN cua ',a,',',b,' bang ',x); ucln:=x; End; {---------------------------------------------------------} Begin Clrscr; Write('Nhap n: ');Readln(n); Write('Nhap m: ');Readln(m); Write('Nhap k: ');Readln(k); If (ucln(m,k) mod ucln(n,m)) =0 then writeln('Cac so da cho la lien ket') else writeln('Cac so da cho khong lien ket'); Readln End.

Related docs
Bài 1
Views: 122  |  Downloads: 4
Bài 1
Views: 3  |  Downloads: 0
BÀI GIẢI
Views: 22  |  Downloads: 0
BÀI 1
Views: 56  |  Downloads: 0
bài 11
Views: 0  |  Downloads: 0
Bài 3.ptnguyco
Views: 2  |  Downloads: 0
Đề bài tập Excel
Views: 159  |  Downloads: 9
Đăng bài cho tạp chí
Views: 24  |  Downloads: 0
bài học về các adjectif
Views: 169  |  Downloads: 3
Bài tập PRONOMS PERSONNELS
Views: 65  |  Downloads: 6
premium docs
Other docs by Mr Ben
india_3
Views: 1  |  Downloads: 0
india_2
Views: 0  |  Downloads: 0
india
Views: 0  |  Downloads: 0
hypo_hyper_2
Views: 0  |  Downloads: 0
hypo_hyper
Views: 0  |  Downloads: 0
HQHVSN_javma 233 1
Views: 0  |  Downloads: 0
hmc_product_tour_3
Views: 0  |  Downloads: 0
hmc_product_tour_2
Views: 0  |  Downloads: 0
hmc_product_tour
Views: 0  |  Downloads: 0
hipaa_phi_use_release_mr
Views: 0  |  Downloads: 0
HIPAA_DOH_med_info_release
Views: 0  |  Downloads: 0
HealthGradesPatientSafetyRelease2008_2
Views: 0  |  Downloads: 0
HealthGradesPatientSafetyRelease2008
Views: 0  |  Downloads: 0
HCLATexasSummary2009
Views: 0  |  Downloads: 0
hb_me_2
Views: 0  |  Downloads: 0