#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
float p1,p2,a1,b1,a2,b2;
float jumlah,kurang,kali,bagi;
cout<<"menghitung jumlah pecahan"<<endl;
cout<<"masukkan p1 =";
cin>>a1;
cin>>b1;
cout<<"masukkan p2 =";
cin>>a2;
cin>>b2;
cout<<"p1="<<a1<<"/"<<b1;
cout<<"\np2="<<a2<<"/"<<b2;
p1=a1/b1;
p2=a2/b2;
jumlah=p1+p2;
kurang=p1-p2;
kali=p1*p2;
bagi=p1/p2;
cout<<"\np1+p2"<<jumlah;
cout<<jumlah;
return 0;
}
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
float p1,p2,a1,b1,a2,b2;
float jumlah,kurang,kali,bagi;
cout<<"menghitung jumlah pecahan"<<endl;
cout<<"masukkan p1 =";
cin>>a1;
cin>>b1;
cout<<"masukkan p2 =";
cin>>a2;
cin>>b2;
cout<<"p1="<<a1<<"/"<<b1;
cout<<"\np2="<<a2<<"/"<<b2;
p1=a1/b1;
p2=a2/b2;
jumlah=p1+p2;
kurang=p1-p2;
kali=p1*p2;
bagi=p1/p2;
cout<<"\np1+p2"<<jumlah;
cout<<jumlah;
return 0;
}