Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies
Program GIAI_HE_HAI_AN; Uses crt; Var a,b,c,d,m,n: real; dx,dy,dd: real; BEGIN Clrscr; Writeln('GIAI HE HAI AN: '); Writeln('----------------------------------'); Write('Nhap a='); readln(a); Write('Nhap b='); readln(b); Write('Nhap c='); readln(c); Write('Nhap d='); readln(d); Write('Nhap m='); readln(m); Write('Nhap n='); readln(n); dd:=a*d-b*c; dx:=m*d-b*n; dy:=a*n-c*m; IF dd=0 then IF (dx=0) And (dy=0) then Writeln('He vo so nghiem hoac vo nghiem') Else writeln('He vo nghiem') Else Begin Write('He co nghiem: '); Writeln('x=',dx/dd: 4: 2,' va y=',dy/dd: 4: 2); End; Readln End.
January 2, 2012 Ví dụ và Bài tập lập trình Pascal
Chương trình Giải hệ phương trình tuyến tính
Program HPT_BAC_NHAT_2_AN; writeln('Giai he phuong trinh bac nhat 2 an'); writeln('------------------------------------------------'); write('nhap he so a= ');readln(a); write('nhap he so b= ');readln(b); write('nhap he so c= ');readln(c); write('nhap he so a1= ');readln(d); write('nhap he so b1= ');readln(e); write('nhap he so c1= ');readln(f); x:= ((c*e)-(f*b))/((a*e)-(d*b)); y:= ((a*f)-(d*c))/((a*e)-(d*b)); writeln('vay phuong trinh co mot nghiem x=',x,' va y=',y); if (((c*e)-(f*b))<>0) or (((a*f)-(d*c))<>0) then writeln('he phuong trinh vo nghiem HI!HI!...HI!'); if (((c*e)-(f*b))= 0) and (((a*f)-(d*c))=0) then writeln('he co vo so nghiem x thuoc R va y=(c-ax)/b nghiem cua he la nghiem cua ax+by=c'); writeln('ban co muon tiep tuc thuc hien nua khong (Y/N)?');readln(traloi); until (traloi='N') or(traloi='n'); writeln('nhan ENTER de ket thuc chuong trinh'); Lập trình giải hệ phương trình bậc nhất hai ẩn bằng pascal: aX + bY =c và a1X + b1Y = c1 Program HPT_BAC_NHAT_2_AN; uses crt; var a,b,c: real; d,e,f: real; x,y: real; traloi: char; begin repeat clrscr; writeln('Giai he phuong trinh bac nhat 2 an'); writeln('------------------------------------------------'); write('nhap he so a= ');readln(a); write('nhap he so b= ');readln(b); write('nhap he so c= ');readln(c); write('nhap he so a1= ');readln(d); write('nhap he so b1= ');readln(e); write('nhap he so c1= ');readln(f); readln; if ((a*e)-(d*b))<>0 then begin x:= ((c*e)-(f*b))/((a*e)-(d*b)); y:= ((a*f)-(d*c))/((a*e)-(d*b)); writeln('vay phuong trinh co mot nghiem x=',x,' va y=',y); end; if ((a*e)-(d*b))=0 then begin if (((c*e)-(f*b))<>0) or (((a*f)-(d*c))<>0) then writeln('he phuong trinh vo nghiem HI!HI!...HI!'); if (((c*e)-(f*b))= 0) and (((a*f)-(d*c))=0) then writeln('he co vo so nghiem x thuoc R va y=(c-ax)/b nghiem cua he la nghiem cua ax+by=c'); end; writeln('ban co muon tiep tuc thuc hien nua khong (Y/N)?');readln(traloi); until (traloi='N') or(traloi='n'); writeln('nhan ENTER de ket thuc chuong trinh'); readln end.
Diễn đàn sinh viên CNTT Quảng Ninh Diễn đàn Công nghệ phần mềm Lập trình ứng dụng Desktop Pascal
Giải hệ phương trình bậc nhất hai ẩn ax + by = m và cx + dy = n
|