递归求最大公约数,无限循环了
求最大公约数,无限循环了。。。什么情况程序代码:
# include "stdio.h" int main(void) { void hcf(int, int); int u, v; scanf("%d %d", &u, &v); hcf(u, v); return 0; } void hcf (int u, int v) { int t, r; if (v > u) { t = u; u = v; v = t; } while ((r = u%v) != 0) { hcf (v, r); } printf("H.C.F = %d\n", v); }