Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 59 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
59
Dung lượng
149,5 KB
Nội dung
THUCHANH 1 program bt1th1; Var a,b,c:real; delta,x,x1,x2:real; Begin writeln('GIAI PHUONG TRINH BAC 2 '); repeat write('Nhap he so a='); readln(a); until a<>0; write('Nhap he so b='); readln(b); write('Nhap he so c='); readln(c); delta:=(b*b-4*a*c); if delta<0 then writeln('phuong trinh vo nghiem'); if delta=0 then begin x:=-b/(2*a); writeln('co nghiem kep x=',x:8:3); end; if delta>0 then begin x1:=(-b+sqrt(delta))/(2*a); x2:=(-b-sqrt(delta))/(2*a); writeln('x1=',x1:8:3); writeln('x2=',x2:8:3); end; readln; END. program bt2th1; Var a,b,c,m,n,p,X1,X2:real; DD,DX,DY:real; BEGIN writeln('nhap gia tri cac he so cua he'); write('a='); readln(a); write('b='); readln(b); write('c='); readln(c); write('m='); readln(m); write('n='); readln(n); write('p='); readln(p); DD:=a*n-m*b; DX:=c*n-b*p; DY:=a*p-c*m; X1:=DX/DD; X2:=DY/DD; if DD=0 then begin if (DX=0) and (DY=0) then writeln('phuong trinh vo so nghiem') else writeln('phuong trinh vo nghiem'); end else begin Writeln('X1=',X1:8:3); writeln('X2=',X2:8:3); end; readln; END. Program bt3th1; Var a,b,c,Cv,s,p:real; BEGIN writeln('nhap he so tam giac:'); write('a='); readln(a); write('b='); readln(b); write('c='); readln(c); p:=(a+b+c)/2; s:=sqrt(p*(p-a)*(p-b)*(p-c)); Cv:=a+b+c; if (a+b>c) and (a+c>b) and (b+c>a) and (a>0) and (b>0) and (c>0) then begin writeln('a,b,c la 3 canh tam giac'); writeln('s=',s:3:1); writeln('Cv=',Cv:3:1); end else writeln('Rat tiec so ban nhap ko thoa man !'); readln; END. program bt4th1; var i,n,tc,tl:integer; begin write('nhap gia tri n='); readln(n); tc:=0; tl:=0; for i:= 1 to n do if i mod 2 =0 then tc:=tc+i else tl:=tl+i; write('tong cac so chan la:',tc:3); write('tong cac so le la:',tl:3); readln; end. program bt5th1; var s:real; i,n:integer; begin writeln('nhap gia tri n='); readln(n); s:=0; for i:= 1 to n do s:=s+1/i; write('tong s=',s:3:1); readln; end. program bt6th1; var T,i,n:integer; S,x:real; begin write('nhap gia tri n='); readln(n); write('nhap gia tri x='); readln(x); T:=1; S:=0; for i:= 1 to n do begin T:=-1*T; S:=S+(T*x)/i; end; write('tong s=',s:5:2); readln; end. program bt7th1; var a,b,c:integer; begin for a:= 1 to 9 do for b:= 0 to 9 do for c:= 0 to 9 do if 100*a+10*b+c= a*a*a+b*b*b+c*c*c then writeln(a,b,c); readln; end. program bt8th1; var x,y,z:integer; begin for x:= 0 to 20 do for y:= 0 to 33 do for z:= 0 to 100 do if (5*x+3*y+z/3=100) and (x+y+z =100) then writeln(x:3,y:3,z:3); readln; end.