I need help making this code work. I\'m trying to get Euclid\'s algorithm to wor
ID: 3636170 • Letter: I
Question
I need help making this code work. I'm trying to get Euclid's algorithm to work.Here's my code:
#include <iostream>
using namespace std;
int main()
{
int a;
int b;
int c;
cout << "Enter two numbers: " << endl;
cin >> a >> b;
while (c != 0)
{
if(a > b)
{
c = a - b;
cout << a - b = c << endl;
}
else if(b > a)
{
c = b - a;
cout << b - a = c << endl;
}
}
cout << "GCD(" << a << ", " << b << ") = " << c
return 0;
}
Explanation / Answer
what is the problem?
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.