Ok i need a program that finds the greatest common divisor of two integers.
1) if A/B is 0 then B is the greatest common divisor
2) if A/B is not 0 then plug B into A and the remainder into B
3) repeat the process
I have to use one function other than main
and display both integers and the greatest common divisor
#include <iostream>
#include <cmath>
using namespace std;
void A_B_Division (int&, int&);
int main()
{
int A, B;
cout<<"Please enter two integers"<<endl;
cin<<A<<B;
cout<<"The integers "<<A<<" and "<<B<<" have the greatest common divisor ";
while (A/B==0)
{
cout<<B<<endl;
}
while (A/B!==0)
{
void A_B_Division (A, B);
}
void A_B_Division (int& A, int& B, double remainder)
{
A%B=remainder
//I'm not sure this will do what i'm trying to do//
A=B
B=remainder
}
}
This is my rough start.. It has some problems but i'm kinda confused as to where to go
I'm not sure how to plug the remainder in to a variable and i'm not sure my loops are right..
can someone give me some pointers?