This wsq was pretty easy, I mean, by following the Euclidean Algorithm you can easily know the greatest common divisor between two values
Here´s a video that help me out when I was trying to understand how to use the principles of Euclid.
https:/
Also, I need to mention that I receive some more help, because I search for similar codes in the web, and here´s what I found to complete my task.
https:/
And here´s my code:
#includeusing namespace std; void newline(){ coutendl; } int common(int first, int second) { if (first==second) { return first; } else if (first>second) { return common(first-second, second); } else { return common(first, second-first); } } int main () { int x,y; cout"Hello, I´m a calculator of the greatest common divisor from two numbers. "endl; newline(); cout"Enter the first number."endl; newline(); cin>>x; newline(); cout"Enter the second number. "endl; newline(); cin>>y; newline(); cout"The greatest common divisor from "x" and "y" is "common(x,y)endl; return 0; }
#WSQ12 by Ever Ibarra Almaral is licensed under a Creative Commons Attribution 4.0 International License.