首頁 C++C++ 輾轉相除法求最大公因數2022年6月11日516 views1 minute read #include <iostream> using namespace std; int main(){ int a, b, t; cin >> a >> b; //(a,b)=(b,r) while(b != 0){ t = b; b = a % b; a = t; } cout << a << '\n'; }