L
Luis
I am trying to write a program that checks to see if a fraction is
reducable, and to do this both numerator and denominator cannot be tre(
prime) will this work? if not can some one fix it up a bit for me? thanks.
# include <iostream.h>
using namespace std;
int main()
{
int numerator;
int denominator;
bool denom;
bool numer;
cin>>numerator;
for (int numCount = 2;numCount<=numerator/2 || numer == false;numCount++)
{
if(numerator%numCount== 0)
{
numer = false;
break;
}
else
{
numer = true;
}
}
cout<<numer ;
return 0;
}
reducable, and to do this both numerator and denominator cannot be tre(
prime) will this work? if not can some one fix it up a bit for me? thanks.
# include <iostream.h>
using namespace std;
int main()
{
int numerator;
int denominator;
bool denom;
bool numer;
cin>>numerator;
for (int numCount = 2;numCount<=numerator/2 || numer == false;numCount++)
{
if(numerator%numCount== 0)
{
numer = false;
break;
}
else
{
numer = true;
}
}
cout<<numer ;
return 0;
}