Hi everybody.
Please read the requirement very carefully. The program I want is not that complicated it should be easy but I'm making a mistake somewhere and I'm not getting the result I want the program is;
A program that reads in the numerators and denominators of two fractions. The program should print the product of the two fractions as fraction and as a percent.
my code is
Code:
#include <iostream>
using namespace std;
int main()
{
int Fn ,Fd, Sn, Sd;
int FracAns;
float PercAns;
cout<<"enter the numerator and the denomenator for the first fraction"<<endl;
cin>>Fn;
cin>>Fd;
cout<<"Enter the numerator and the denomentaor"<<endl;
cout<<"for the second fraction"<<endl;
cin>>Sn;
cin>>Fd;
if (Fd==0 || Sd==0)
{
cout<<"You cant not divide by zero, try again"<<endl;
}
else
FracAns = Fn*Sn / Fd*Sd ;
PercAns = FracAns / 100;
cout<< "the procuct of the two fraction as a fraction is: "<<endl;
cout<<FracAns<<endl;
cout<< " as percentage is "<<PercAns<<endl;
return ;
}
//I hope I'm using the right code tags here.
my program does not getting the result I want either for math. problem or for programming one please I just want to know what is wrong I'm doing. I'm just doing that for fun and as a chanllenge for me and for everybody in this beautiful forum. Thanks.