ユークリッドの互除法ってどう実装してますか?
int m,n,tmp
//m,nに対する入力は省略。m≧nとする。
while(n!=0){
tmp=m%nセミコロン
m=nセミコロン
n=tmpセミコロン
}