<div>
<div><noscript>phân số (move your mouse to reveal the content)</noscript>
phân số (open)
phân số (close)
</div>
<div>
<div><blockquote>
Mã nguồn PHP:
[color=#000000]
package coder[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]inputstreamreader[/color][color=#007700];[/color][color=#ff8000]/*** tinh tong hieu tich thuong cua 2 phan so tim uoc chung lon nhat cua 2 phan so* do. so lieu nhapvao tu ban phim*/[/color][color=#007700]public class [/color][color=#0000bb]b04_phanso [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]b04_phanso test [/color][color=#007700]= new [/color][color=#0000bb]b04_phanso[/color][color=#007700](); [/color][color=#0000bb]phanso ps1 [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]phanso ps2 [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap phan so thu 1: "[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapps[/color][color=#007700]([/color][color=#0000bb]ps1[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap phan so thu 2: "[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapps[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"tong 2 phan so : "[/color][color=#007700]+ [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]tongps[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hieu 2 phan so : "[/color][color=#007700]+ [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]hieups[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"tich 2 phan so : "[/color][color=#007700]+ [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]tichps[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thuong 2 phan so: "[/color][color=#007700]+ [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]thuongps[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"uoc chung lon nhat ("[/color][color=#007700]+[/color][color=#0000bb]ps1[/color][color=#007700]+[/color][color=#dd0000]","[/color][color=#007700]+[/color][color=#0000bb]ps2[/color][color=#007700]+[/color][color=#dd0000]") = "[/color][color=#007700]+[/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]ucln[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); } public [/color][color=#0000bb]void nhapps[/color][color=#007700]([/color][color=#0000bb]phanso ps[/color][color=#007700]){ [/color][color=#0000bb]bufferedreader bf [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700](new [/color][color=#0000bb]inputstreamreader[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700])); try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap tu so : "[/color][color=#007700]); [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]settu[/color][color=#007700]([/color][color=#0000bb]double[/color][color=#007700].[/color][color=#0000bb]parsedouble[/color][color=#007700]([/color][color=#0000bb]bf[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]())); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap mau so : "[/color][color=#007700]); [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]setmau[/color][color=#007700]([/color][color=#0000bb]double[/color][color=#007700].[/color][color=#0000bb]parsedouble[/color][color=#007700]([/color][color=#0000bb]bf[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]())); } catch ([/color][color=#0000bb]numberformatexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"format error: "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"input error : "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } }} class [/color][color=#0000bb]phanso [/color][color=#007700]{ private [/color][color=#0000bb]double tu[/color][color=#007700], [/color][color=#0000bb]mau[/color][color=#007700]; public [/color][color=#0000bb]phanso[/color][color=#007700]() { } public [/color][color=#0000bb]phanso[/color][color=#007700]([/color][color=#0000bb]double tu[/color][color=#007700], [/color][color=#0000bb]double mau[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]tu[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]mau[/color][color=#007700]; } public [/color][color=#0000bb]double gettu[/color][color=#007700]() { return [/color][color=#0000bb]tu[/color][color=#007700]; } public [/color][color=#0000bb]void settu[/color][color=#007700]([/color][color=#0000bb]double tu[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]tu[/color][color=#007700]; } public [/color][color=#0000bb]double getmau[/color][color=#007700]() { return [/color][color=#0000bb]mau[/color][color=#007700]; } public [/color][color=#0000bb]void setmau[/color][color=#007700]([/color][color=#0000bb]double mau[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]mau[/color][color=#007700]; } public [/color][color=#0000bb]int ucln[/color][color=#007700]([/color][color=#0000bb]double a[/color][color=#007700], [/color][color=#0000bb]double b[/color][color=#007700]){ return (int) ([/color][color=#0000bb]b [/color][color=#007700]== [/color][color=#0000bb]0 [/color][color=#007700]? [/color][color=#0000bb]a [/color][color=#007700]: [/color][color=#0000bb]ucln[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700], [/color][color=#0000bb]a [/color][color=#007700]% [/color][color=#0000bb]b[/color][color=#007700])); } public [/color][color=#0000bb]double uclnps[/color][color=#007700]([/color][color=#0000bb]double a[/color][color=#007700], [/color][color=#0000bb]double b[/color][color=#007700]){ return ([/color][color=#0000bb]b [/color][color=#007700]== [/color][color=#0000bb]0 [/color][color=#007700]? [/color][color=#0000bb]a [/color][color=#007700]: [/color][color=#0000bb]ucln[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700], [/color][color=#0000bb]a [/color][color=#007700]% [/color][color=#0000bb]b[/color][color=#007700])); } public [/color][color=#0000bb]double ucln[/color][color=#007700]( [/color][color=#0000bb]phanso ps[/color][color=#007700]) { [/color][color=#0000bb]double a [/color][color=#007700]=[/color][color=#0000bb]tu[/color][color=#007700]/[/color][color=#0000bb]mau[/color][color=#007700]; [/color][color=#0000bb]double b [/color][color=#007700]= [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]/[/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; return ([/color][color=#0000bb]b [/color][color=#007700]== [/color][color=#0000bb]0 [/color][color=#007700]? [/color][color=#0000bb]a [/color][color=#007700]: [/color][color=#0000bb]uclnps[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700], [/color][color=#0000bb]a [/color][color=#007700]% [/color][color=#0000bb]b[/color][color=#007700])); } public [/color][color=#0000bb]double bcnn[/color][color=#007700]([/color][color=#0000bb]double a[/color][color=#007700], [/color][color=#0000bb]double b[/color][color=#007700]) { return ([/color][color=#0000bb]a [/color][color=#007700]* [/color][color=#0000bb]b[/color][color=#007700]) / ([/color][color=#0000bb]ucln[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700], [/color][color=#0000bb]b[/color][color=#007700])); } public [/color][color=#0000bb]string tostring[/color][color=#007700](){ return [/color][color=#0000bb]tu[/color][color=#007700]+[/color][color=#dd0000]"/"[/color][color=#007700]+[/color][color=#0000bb]mau[/color][color=#007700]; } public [/color][color=#0000bb]phanso tongps[/color][color=#007700]([/color][color=#0000bb]phanso another[/color][color=#007700]) { [/color][color=#0000bb]phanso tongps [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]tongps[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]tu [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]+ [/color][color=#0000bb]mau [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]; [/color][color=#0000bb]tongps[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; return [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]tongps[/color][color=#007700]); } public [/color][color=#0000bb]phanso hieups[/color][color=#007700]([/color][color=#0000bb]phanso another[/color][color=#007700]) { [/color][color=#0000bb]phanso hieups [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]hieups[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]tu [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]- [/color][color=#0000bb]mau [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]; [/color][color=#0000bb]hieups[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]* [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; return [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]hieups[/color][color=#007700]); } public [/color][color=#0000bb]phanso tichps[/color][color=#007700]([/color][color=#0000bb]phanso another[/color][color=#007700]){ [/color][color=#0000bb]phanso tichps [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]tichps[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]tu[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]; [/color][color=#0000bb]tichps[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]mau[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; return [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]tichps[/color][color=#007700]); } public [/color][color=#0000bb]phanso tichps[/color][color=#007700]([/color][color=#0000bb]phanso ps1[/color][color=#007700], [/color][color=#0000bb]phanso ps2[/color][color=#007700]){ [/color][color=#0000bb]phanso tichps [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]tichps[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]*[/color][color=#0000bb]ps2[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]; [/color][color=#0000bb]tichps[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]ps1[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]*[/color][color=#0000bb]ps2[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; return [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]tichps[/color][color=#007700]); } public [/color][color=#0000bb]phanso nghichdao[/color][color=#007700]([/color][color=#0000bb]phanso ps[/color][color=#007700]){ [/color][color=#0000bb]phanso psnew [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]psnew[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]; [/color][color=#0000bb]psnew[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]; return [/color][color=#0000bb]psnew[/color][color=#007700]; } public [/color][color=#0000bb]phanso thuongps[/color][color=#007700]([/color][color=#0000bb]phanso another[/color][color=#007700]){ [/color][color=#0000bb]phanso thuongps [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]thuongps [/color][color=#007700]= [/color][color=#0000bb]tichps[/color][color=#007700]([/color][color=#0000bb]nghichdao[/color][color=#007700]([/color][color=#0000bb]another[/color][color=#007700])); return [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]thuongps[/color][color=#007700]); } public [/color][color=#0000bb]void thuongps[/color][color=#007700]([/color][color=#0000bb]phanso ps1[/color][color=#007700], [/color][color=#0000bb]phanso ps2[/color][color=#007700]){ [/color][color=#0000bb]phanso thuongps [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]thuongps [/color][color=#007700]= [/color][color=#0000bb]tichps[/color][color=#007700]([/color][color=#0000bb]ps1[/color][color=#007700],[/color][color=#0000bb]nghichdao[/color][color=#007700]([/color][color=#0000bb]ps2[/color][color=#007700])); [/color][color=#0000bb]thuongps [/color][color=#007700]= [/color][color=#0000bb]pstoigian[/color][color=#007700]([/color][color=#0000bb]thuongps[/color][color=#007700]); } public [/color][color=#0000bb]phanso pstoigian[/color][color=#007700]([/color][color=#0000bb]phanso ps[/color][color=#007700]){ [/color][color=#0000bb]phanso pstoigian [/color][color=#007700]= new [/color][color=#0000bb]phanso[/color][color=#007700](); [/color][color=#0000bb]int a [/color][color=#007700]= [/color][color=#0000bb]ucln[/color][color=#007700]([/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700], [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]); [/color][color=#0000bb]pstoigian[/color][color=#007700].[/color][color=#0000bb]tu [/color][color=#007700]= [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]tu[/color][color=#007700]/[/color][color=#0000bb]a[/color][color=#007700]; [/color][color=#0000bb]pstoigian[/color][color=#007700].[/color][color=#0000bb]mau [/color][color=#007700]= [/color][color=#0000bb]ps[/color][color=#007700].[/color][color=#0000bb]mau[/color][color=#007700]/[/color][color=#0000bb]a[/color][color=#007700]; return [/color][color=#0000bb]pstoigian[/color][color=#007700]; }}[/color]
</blockquote></div>
</div>
</div>
<div>
<div><noscript>số phức (move your mouse to reveal the content)</noscript>
số phức (open)
số phức (close)
</div>
<div>
<div><blockquote>
Mã nguồn PHP:
[color=#000000]
package coder[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]bufferedreader[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]inputstreamreader[/color][color=#007700];[/color][color=#ff8000]/*** tinh tong, hieu, tich thuong cua so phuc du lieu nhap tu ban phim*/[/color][color=#007700]public class [/color][color=#0000bb]b05_sophuc [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]b05_sophuc test [/color][color=#007700]= new [/color][color=#0000bb]b05_sophuc[/color][color=#007700](); [/color][color=#0000bb]sophuc sp1 [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]sophuc sp2 [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]sophuc sp3 [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so phuc thu 1: "[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapsp[/color][color=#007700]([/color][color=#0000bb]sp1[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so phuc thu 2: "[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapsp[/color][color=#007700]([/color][color=#0000bb]sp2[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"tong 2 so phuc: "[/color][color=#007700]+ [/color][color=#0000bb]sp1[/color][color=#007700].[/color][color=#0000bb]tongsp[/color][color=#007700]([/color][color=#0000bb]sp2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hieu 2 so phuc: "[/color][color=#007700]+ [/color][color=#0000bb]sp1[/color][color=#007700].[/color][color=#0000bb]hieusp[/color][color=#007700]([/color][color=#0000bb]sp2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"tich 2 so phuc: "[/color][color=#007700]+ [/color][color=#0000bb]sp1[/color][color=#007700].[/color][color=#0000bb]tichsp[/color][color=#007700]([/color][color=#0000bb]sp2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thuong 2 so phuc: "[/color][color=#007700]+ [/color][color=#0000bb]sp1[/color][color=#007700].[/color][color=#0000bb]thuongsp[/color][color=#007700]([/color][color=#0000bb]sp2[/color][color=#007700])); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"so nghich dao cua "[/color][color=#007700]+[/color][color=#0000bb]sp1[/color][color=#007700]+ [/color][color=#dd0000]" la: "[/color][color=#007700]+[/color][color=#0000bb]sp3[/color][color=#007700].[/color][color=#0000bb]songhichdaosp[/color][color=#007700]([/color][color=#0000bb]sp1[/color][color=#007700])); } public [/color][color=#0000bb]void nhapsp[/color][color=#007700]([/color][color=#0000bb]sophuc sp[/color][color=#007700]){ [/color][color=#0000bb]bufferedreader bf [/color][color=#007700]= new [/color][color=#0000bb]bufferedreader[/color][color=#007700](new [/color][color=#0000bb]inputstreamreader[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700])); try { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap phan thuc: "[/color][color=#007700]); [/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]setphanthuc[/color][color=#007700]([/color][color=#0000bb]double[/color][color=#007700].[/color][color=#0000bb]parsedouble[/color][color=#007700]([/color][color=#0000bb]bf[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]())); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap phan ao: "[/color][color=#007700]); [/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]setphanao[/color][color=#007700]([/color][color=#0000bb]double[/color][color=#007700].[/color][color=#0000bb]parsedouble[/color][color=#007700]([/color][color=#0000bb]bf[/color][color=#007700].[/color][color=#0000bb]readline[/color][color=#007700]())); } catch ([/color][color=#0000bb]numberformatexception e[/color][color=#007700]) { [/color][color=#ff8000]// todo: handle exception [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"format error : "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception e[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"input error : "[/color][color=#007700]+[/color][color=#0000bb]e[/color][color=#007700]); [/color][color=#ff8000]// todo: handle exception [/color][color=#007700]} } } class [/color][color=#0000bb]sophuc [/color][color=#007700]{ private [/color][color=#0000bb]double phanthuc[/color][color=#007700], [/color][color=#0000bb]phanao[/color][color=#007700]; public [/color][color=#0000bb]sophuc[/color][color=#007700]() { [/color][color=#0000bb]super[/color][color=#007700](); } public [/color][color=#0000bb]sophuc[/color][color=#007700]([/color][color=#0000bb]double phanthuc[/color][color=#007700], [/color][color=#0000bb]double phanao[/color][color=#007700]) { [/color][color=#0000bb]super[/color][color=#007700](); [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]phanthuc[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]phanao[/color][color=#007700]; } public [/color][color=#0000bb]sophuc tongsp[/color][color=#007700]([/color][color=#0000bb]sophuc another[/color][color=#007700]) { [/color][color=#0000bb]sophuc tongsp [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]tongsp[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]phanthuc [/color][color=#007700]+ [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700]; [/color][color=#0000bb]tongsp[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]phanao [/color][color=#007700]+ [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]; return [/color][color=#0000bb]tongsp[/color][color=#007700]; } public [/color][color=#0000bb]sophuc hieusp[/color][color=#007700]([/color][color=#0000bb]sophuc another[/color][color=#007700]) { [/color][color=#0000bb]sophuc hieusp [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]hieusp[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]phanthuc [/color][color=#007700]- [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700]; [/color][color=#0000bb]hieusp[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]phanao [/color][color=#007700]- [/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]; return [/color][color=#0000bb]hieusp[/color][color=#007700]; } public [/color][color=#0000bb]sophuc tichsp[/color][color=#007700]([/color][color=#0000bb]sophuc another[/color][color=#007700]){ [/color][color=#0000bb]sophuc tichsp [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]tichsp[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]phanthuc[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]- [/color][color=#0000bb]phanao[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]; [/color][color=#0000bb]tichsp[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]phanthuc[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]+[/color][color=#0000bb]phanao[/color][color=#007700]*[/color][color=#0000bb]another[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700]; return [/color][color=#0000bb]tichsp[/color][color=#007700]; } public [/color][color=#0000bb]sophuc thuongsp[/color][color=#007700]([/color][color=#0000bb]sophuc another[/color][color=#007700]){ [/color][color=#0000bb]sophuc thuongsp [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700]([/color][color=#0000bb]phanthuc[/color][color=#007700],[/color][color=#0000bb]phanao[/color][color=#007700]); return [/color][color=#0000bb]thuongsp[/color][color=#007700].[/color][color=#0000bb]tichsp[/color][color=#007700]([/color][color=#0000bb]songhichdaosp[/color][color=#007700]([/color][color=#0000bb]another[/color][color=#007700])); } public [/color][color=#0000bb]sophuc sodoisp[/color][color=#007700]([/color][color=#0000bb]sophuc sp[/color][color=#007700]){ [/color][color=#0000bb]sophuc sodoi [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]sodoi[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700]; [/color][color=#0000bb]sodoi[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= -[/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]; return [/color][color=#0000bb]sodoi[/color][color=#007700]; } public [/color][color=#0000bb]sophuc songhichdaosp[/color][color=#007700]([/color][color=#0000bb]sophuc sp[/color][color=#007700]) { [/color][color=#0000bb]sophuc songhichdao [/color][color=#007700]= new [/color][color=#0000bb]sophuc[/color][color=#007700](); [/color][color=#0000bb]sophuc temp [/color][color=#007700]= [/color][color=#0000bb]sodoisp[/color][color=#007700]([/color][color=#0000bb]sp[/color][color=#007700]); [/color][color=#0000bb]double d [/color][color=#007700]= ([/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700])*([/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700])+([/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700])*([/color][color=#0000bb]sp[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]); [/color][color=#0000bb]songhichdao[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]temp[/color][color=#007700].[/color][color=#0000bb]phanthuc[/color][color=#007700]/[/color][color=#0000bb]d[/color][color=#007700]; [/color][color=#0000bb]songhichdao[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]temp[/color][color=#007700].[/color][color=#0000bb]phanao[/color][color=#007700]/[/color][color=#0000bb]d[/color][color=#007700]; return [/color][color=#0000bb]songhichdao[/color][color=#007700]; } public [/color][color=#0000bb]string tostring[/color][color=#007700]() { return [/color][color=#dd0000]"z = " [/color][color=#007700]+ [/color][color=#0000bb]phanthuc [/color][color=#007700]+ [/color][color=#dd0000]"+(" [/color][color=#007700]+ [/color][color=#0000bb]phanao [/color][color=#007700]+ [/color][color=#dd0000]")*i"[/color][color=#007700]; } public [/color][color=#0000bb]double getphanthuc[/color][color=#007700]() { return [/color][color=#0000bb]phanthuc[/color][color=#007700]; } public [/color][color=#0000bb]void setphanthuc[/color][color=#007700]([/color][color=#0000bb]double phanthuc[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]phanthuc [/color][color=#007700]= [/color][color=#0000bb]phanthuc[/color][color=#007700]; } public [/color][color=#0000bb]double getphanao[/color][color=#007700]() { return [/color][color=#0000bb]phanao[/color][color=#007700]; } public [/color][color=#0000bb]void setphanao[/color][color=#007700]([/color][color=#0000bb]double phanao[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]phanao [/color][color=#007700]= [/color][color=#0000bb]phanao[/color][color=#007700]; } }[/color]
</blockquote></div>
</div>
</div>
đây là code của 2 bài phân số và số phức của em, mọi người xem code như vậy liệu đã ổn chưa ạ và có thể làm tối ưu hơn được không ạ, mong mọi người góp ý để em sửa ạ. em cám ơn
Căn hộ cao cấp dự án Phú Đông Smart City đầu tư bởi Phú Đông Group tầm nhìn tuyệt mỹ trải rộng view xu hướng đẳng cấp. bán căn hộ Phú Đông Smart City tầm nhìn tuyệt mỹ giá hợp lý địa thế vượt trội....
Căn hộ chung cư Phú Đông Smart City khu hiện đại