Here is the code for the simplest of all the questions.
#include <iostream>
#include <string>
using namespace std;
int gcd(int m,int n) {
if ((m % n) = 0) //evaluates whether m can be divided by n without a remainder then n is the gcd
return n;
else
return gcd(n,(m % n)); //use the c++ bult in function to return the gcd for u if you read the section on recursive functions you will have known this
}
int main() {
int m, n;
cout << "Please enter two integers: " << endl;
cin >> m >> n;
cout << " Greatest common divisor for " << m << " / " << " n " <<
" is: " << gcd(m,n) << endl;
return 0;
}
Please no insult, but gcd you were thought in std 7 or 8 I think can't remember. Now just code it, it is simple.