Phân Số #include<iostream> #include<cmath> using namespace std; int ucln(int a, int b) { while(a!=0 && b!=0) if(a>b) a=abs(a-b); else b=abs(b-a); if(a==0) return b; else return a; } struct phanso { int tu; int mau; }; void rutgon(phanso a) { phanso c; c.tu=a.tu/ucln(a.tu, a.mau); c.mau=a.mau/ucln(a.tu, a.mau); cout<<"Tu sau khi rut gon la:"<<c.tu<<endl; cout<<"Mau sau khi rut gon la:"<<c.mau<<endl; } void cong(phanso a, phanso b) { phanso c; c.tu=a.tu*b.mau+b.tu*a.mau; c.mau=a.mau*b.mau; rutgon(c); } void main() { phanso a,b, c; cout<<"Nhap tu cua pahn so :";cin>>a.tu;