while(r)
12345678910111213141516171819
#include <iostream> using namespace std; int sgd(int m, int n){ int r=m%n; while(r){ m=n; n=r; r=m%n; } return n; } int main(){ int number1, number2, answer; cout << "Enter two integers: "; cin >> number1 >> number2; answer = sgd(number1, number2); cout << answer; }