I am having trouble to simplify the answer.
using namespace std;
int main(){
double dblA, dblB, dblC, dblD, dblproductN, dblproductD,dblsumN,dblsumD, dblGCF, dblsimplifyNsum, dblsimplifyDsum;
double dblsimplifyNproduct, dblsimplifySproduct;
int M,N;
int R=M%N;
while(R!=0)
{M=N;
N=R;
R=M%N;}
{
cout<<"Enter the numerator and the denomenator of the first positive fraction separated by a space=>"<<endl;
cin>>dblA>>dblB;
cout<<"Enter the numerator and the denaminator of the second positive fraction separated by a space=>"<<endl;
cin>>dblC>>dblD;
dblproductN =(dblA*dblC);
dblproductD =(dblB*dblD);
dblsumN = (dblA*dblD)+(dblC*dblB);
//dblGCF = N;
//dblsimplifyNsum= (dblsumN)/(dblGCF);
//dblsimplifyDsum= (dblproductD)/(dblGCF);
//dblsimplifyNproduct= (dblproductN) / (dblGCF);
//dblsimplifySproduct = (dblproductD) / (dblGCF);
cout<<"the sum of the fractions is" <<dblsu
Copyright © 2024 VQUIX.COM - All rights reserved.
Answers & Comments
Verified answer
http://en.wikipedia.org/wiki/Euclidean_algorithm
http://en.wikipedia.org/wiki/Binary_GCD_algorithm